CVE-2026-31526: bpf: Fix exception exit lock checking for subprogs
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix exception exit lock checking for subprogs
processbpfexitfull() passes checklock = !curframe to checkresourceleak(), which is false in cases when bpfthrow() is called from a static subprog. This makes checkresourceleak() to skip validation of activerculocks, activepreemptlocks, and activeirqid on exception exits from subprogs.
At runtime bpfthrow() unwinds the stack via ORC without releasing any user-acquired locks, which may cause various issues as the result.
Fix by setting checklock = true for exception exits regardless of curframe, since exceptions bypass all intermediate frame cleanup. Update the error message prefix to "bpfthrow" for exception exits to distinguish them from normal BPFEXIT.
Fix rejectsubprogwithrcureadlock test which was previously passing for the wrong reason. Test program returned directly from the subprog call without closing the RCU section, so the error was triggered by the unclosed RCU lock on normal exit, not by bpfthrow. Update msg annotations for affected tests to match the new "bpfthrow" error prefix.
The spinlock case is not affected because they are already checked [1] at the call site in docheckinsn() before bpfthrow can run.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/bpf/verifier.c?h=v7.0-rc4#n21098
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31526?
The severity of CVE-2026-31526 is categorized as important due to potential impact on system stability.
How do I fix CVE-2026-31526?
To fix CVE-2026-31526, update the Linux kernel to the latest version where the vulnerability has been patched.
What systems are affected by CVE-2026-31526?
CVE-2026-31526 affects versions of the Linux kernel that utilize the BPF (Berkeley Packet Filter) functionality.
What type of vulnerability is CVE-2026-31526?
CVE-2026-31526 is a vulnerability related to improper lock checking leading to potential resource leak issues.
Is there a workaround for CVE-2026-31526?
There is no known workaround for CVE-2026-31526, and the recommended action is to apply the security update.