CVE-2026-31526 bpf: Fix exception exit lock checking for subprogs

Medium 5.5 Published Updated

A flaw in the Linux kernel BPF verifier allows skipping lock checks during exception exits, potentially leading to deadlocks or privilege escalation.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2026-31526?

CVE-2026-31526 is a medium-severity vulnerability in Linux kernel, published on 22 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix exception exit lock checking for subprogs

process_bpf_exit_full() passes check_lock = !curframe to check_resource_leak(), which is false in cases when bpf_throw() is called from a static subprog. This makes check_resource_leak() to skip validation of active_rcu_locks, active_preempt_locks, and active_irq_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 check_lock = true for exception exits regardless of curframe, since exceptions bypass all intermediate frame cleanup. Update the error message prefix to "bpf_throw" for exception exits to distinguish them from normal BPF_EXIT.

Fix reject_subprog_with_rcu_read_lock 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 bpf_throw. Update __msg annotations for affected tests to match the new "bpf_throw" error prefix.

The spin_lock case is not affected because they are already checked [1] at the call site in do_check_insn() before bpf_throw 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

Weakness: CWE-667

Which versions are affected by CVE-2026-31526?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2026-31526?

Apply the vendor's patch.

Is CVE-2026-31526 being exploited?

There is no known exploitation of CVE-2026-31526 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2026-31526, DEBIAN-CVE-2026-31526, GHSA-rggx-c6x2-98g3, ROOT-OS-DEBIAN-13-CVE-2026-31526, ROOT-OS-UBUNTU-2404-CVE-2026-31526, UBUNTU-CVE-2026-31526.

Is CVE-2026-31526 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free