CVE-2026-31526

Source
https://cve.org/CVERecord?id=CVE-2026-31526
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31526.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2026-31526
Downstream
Related
Published
2026-04-22T13:54:39.800Z
Modified
2026-06-02T18:29:21.350238502Z
Summary
bpf: Fix exception exit lock checking for subprogs
Details

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 activeirq_id on exception exits from subprogs.

At runtime bpf_throw() 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 BPF_EXIT.

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

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31526.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
f18b03fabaa9b7c80e80b72a621f481f0d706ae0
Fixed
c0281da1f2aa5c2fca3a05f79b86bea96591c358
Fixed
5a399f3117642494e35545f6ca397d3e177c1f9b
Fixed
6c2128505f61b504c79a20b89596feba61388112

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31526.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.18.21
Type
ECOSYSTEM
Events
Introduced
6.19.0
Fixed
6.19.11

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-31526.json"