CVE-2026-139294: bpf: Use the socket of a sk_lookup test run under RCU
In the Linux kernel, the following vulnerability has been resolved:
bpf: Use the socket of a sklookup test run under RCU
bpfsklookupassign() accepts only sockets which are freed by RCU, and takes no reference. bpfprogtestrunsklookup() looks at skreuseport of the selected socket and generates its cookie, which is a write, behind bpftesttimerleave(), that is outside of the RCU read side critical section in which the program ran. If the socket is closed in the meantime it may be gone.
Do both before the section ends.
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems running the Linux kernel are affected in the sk_lookup BPF program test-run path. The issue involves a selected socket being closed after the BPF program runs but before its reuseport state is examined and its cookie is generated.
What condition is needed to trigger the race?
An attacker or concurrent actor would need the selected socket to be closed during the interval after bpf_prog_test_run_sk_lookup() leaves its RCU read-side critical section and before it accesses sk_reuseport or generates the socket cookie.
What does the fix change?
The fix performs the sk_reuseport check and socket-cookie generation before the RCU read-side critical section ends, keeping access to the RCU-freed socket protected.