HIGH Introduced in 6.9
bpf RbtreeCallback Bypass
CVE-2026-98047
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Check ancestor frames for rbtree callbacks bpf_rbtree_add() invokes its comparator while the caller holds the root lock. The native insertion code retains raw parent and link pointers across the callback, so the verifier prohibits unlocking, consuming tree nodes, or changing RCU state from that callback. in_rbtree_lock_required_cb() only checks the innermost verifier frame. Static subprogram calls are permitted while holding a spin lock, and such a call pushes a frame without in_callback_fn set. Consequently, all callback restrictions disappear in the nested frame. The subprogram can unlock the tree, remove and drop the node being compared, then relock. Native insertion resumes with the stale parent pointer and links freed memory into the tree. Walk all active frames for the rbtree callback instead. Benign static subprograms remain permitted, while callback restrictions follow execution into nested frames.
02KernelScan AI Analysis
Risk summary
A BPF verifier bypass allows a local attacker who can load BPF programs to achieve kernel memory corruption by exploiting missing callback-restriction enforcement across nested subprogram frames. The resulting use-after-free can lead to privilege escalation, arbitrary kernel read/write, or kernel panics. Systems permitting unprivileged or container-based BPF program loading are at highest risk.
Vulnerability analysis
The BPF verifier checks only the innermost call frame when deciding whether code is executing inside an rbtree comparator callback that holds restrictions on unlocking, freeing nodes, or changing RCU state. When a BPF program calls a static subprogram from within such a callback, the nested frame is not marked as being in a callback context, so all restrictions disappear in that frame. A malicious program can unlock the rbtree, free the node being compared, and relock — while the native insertion code retains stale parent and link pointers, causing freed memory to be linked into the tree. The fix walks all ancestor frames to determine whether any enclosing frame is an rbtree callback, ensuring that callback restrictions follow execution into nested subprograms. This vulnerability is reachable locally by any process able to load BPF programs, which requires CAP_BPF on most distributions.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.18 | 6.9 | 6.18.53 | b545fa447e09 |
| 7.2 | 6.9 | 7.2.7 | 2410cb2ac041 |
| mainline | 6.9 | 7.3-rc2 | 369f4ce73457 |