HIGH Introduced in 6.15
bpf RbtreeCallback UAF
CVE-2026-98060
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.7HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Reject resilient lock operations in rbtree callbacks __bpf_rbtree_add() keeps parent and link pointers live across calls to the program-supplied comparison callback. The verifier therefore requires the root's lock to remain held throughout the callback. The helper path enforces this rule for bpf_spin_lock() and bpf_spin_unlock(), but the resilient lock kfunc argument path does not. Since resilient locks may protect BPF rbtree roots, a callback can release the root lock and let another CPU remove and free the node referenced by the in-progress tree walk. The walk then resumes using freed pointers. Reject resilient lock kfuncs in an rbtree comparison callback, matching the existing policy for the spin lock helpers. Resilient-lock-protected trees remain valid when their comparison callbacks leave lock state alone.
02KernelScan AI Analysis
Risk summary
A BPF program can release the lock protecting an rbtree root during a comparison callback, allowing another CPU to free the node the in-progress tree walk is still referencing. This results in a use-after-free in kernel memory, reachable by any local user who can load BPF programs. The issue is exploitable from containers and multi-tenant environments where unprivileged BPF or user-namespace capabilities are available.
Vulnerability analysis
When inserting into a BPF rbtree, the kernel calls a program-supplied comparison callback while holding live parent and link pointers from the ongoing tree walk. The verifier already forbids the classic spin-lock helpers inside these callbacks so the root lock cannot be dropped mid-walk, but it failed to apply the same restriction to the newer resilient lock kfuncs. A malicious program can therefore call the resilient unlock kfunc from its comparison callback, release the root lock, and let a concurrent CPU remove and free the very node the walk is iterating over; when the walk resumes it dereferences freed memory. The fix adds a verifier check that rejects resilient lock and unlock kfuncs in any rbtree comparison callback, mirroring the existing policy for spin-lock helpers. The vulnerable path is reached by loading a BPF program, which requires CAP_BPF (or unprivileged BPF if enabled), making it a local attack surface relevant to container hosts and multi-tenant systems.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.18 | 6.15 | 6.18.53 | cc2e065ed206 |
| 7.2 | 6.15 | 7.2.7 | 71930202a0a0 |
| mainline | 6.15 | 7.3 | 7b7b8b596010 |