CVE-2026-139700: bpf: Fix program BTF use-after-free in sleepable programs
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix program BTF use-after-free in sleepable programs
Object kfunc calls embed metadata owned by the program BTF. A sleepable program can remain active under Tasks Trace RCU after its last reference is dropped, while program teardown releases the BTF through ordinary RCU. The invocation can then dereference freed metadata in bpfobjnew().
Move btfput() into bpfprogputrcu(), the callback that frees the program. When teardown is deferred, that callback runs after the program's own grace period (Tasks Trace RCU for sleepable programs and ordinary RCU otherwise), so the BTF outlives every active invocation. The non-deferred path invokes the callback synchronously, so load-error cleanup stays direct.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this use-after-free condition?
Systems running Linux kernel BPF programs that are sleepable and use object kfunc calls are exposed. The issue involves metadata owned by the program's BTF during program teardown.
What timing is required for exploitation or triggering?
A sleepable BPF program must remain active under Tasks Trace RCU after its final reference is dropped. If teardown releases the program BTF through ordinary RCU before that active invocation finishes, bpf_obj_new() can dereference freed metadata.
Is the issue limited to deferred program teardown?
The vulnerable lifetime mismatch occurs when program teardown is deferred for an active sleepable program. The described fix also preserves direct cleanup for load errors by invoking the freeing callback synchronously on the non-deferred path.
What is the remediation?
Apply a Linux kernel update containing the fix that moves btf_put() into __bpf_prog_put_rcu(). This ensures program BTF is retained until the program's applicable grace period has completed.