CVE-2026-139306

bpf: Keep a program until its bpf_wq callback has ended

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

bpf: Keep a program until its bpf_wq callback has ended

bpf_wq_work() runs the callback under rcu_read_lock_trace() only, since
the callback may sleep. The program it belongs to need not be sleepable,
and such a program is freed behind a plain RCU grace period. The
reference that the bpf_wq holds is dropped when the map element goes, or
when another callback is set, no matter whether the work is running.

If that was the last reference the program is freed under the running
callback, and the worker goes on in the freed JIT image:

Oops: int3: 0000 [#1] SMP NOPTI
RIP: 0010:0xffffffffc0600947

All it takes is to close the map and the program while the callback runs.

Note in the program that it has a callback that runs sleepable, and wait
for an RCU Tasks Trace grace period, which implies a plain one, before
such a program is freed. Let bpf_wq_work() enter its read side critical
section before it reads callback_fn.

bpf_task_work holds a reference to the program until the callback is done.

Analysis

AI-generated

Technical impact

bpf_wq_work() runs a callback under rcu_read_lock_trace() because the callback may sleep. The program belonging to the callback is not guaranteed to be sleepable, and the reference that bpf_wq holds is dropped when the map element goes or when another callback is set, regardless of whether the work is still running. If that drop leaves the program with no remaining reference, the kernel frees the JIT image while the callback is executing, which leads to an Oops as the worker continues in the freed memory. The vulnerability is a use‑after‑free race that can cause a kernel crash and data corruption, effectively denying service to the affected host.

Affected Systems

The issue is present in all Linux kernel releases that support BPF via bpf_wq, with no version range specified in the vendor advisory. Therefore, every unpatched Linux kernel containing this code path is potentially vulnerable, regardless of distribution or release.

Risk and Exploitability

The CVE is not listed in the CISA KEV catalog and no EPSS score is available, indicating that known public exploitation is currently absent. An attacker would need privileged local access to load a BPF program with a sleepable callback and then close the map and program while the callback is still running. Even though the attack surface is limited to trusted users, the resulting kernel crash can halt the system and may provide a foothold for privilege escalation. The overall risk is moderate to high for environments that allow arbitrary BPF loading, but the likelihood of a successful exploit remains low until an external exploit is released.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the kernel to a patched release that resolves the race condition.
  • Limit BPF program loading by revoking CAP_SYS_ADMIN or configuring SELinux to deny load_bpf for untrusted users.
  • Monitor system logs for Oops messages that reference bpf_wq_work and investigate any crashes promptly. The patch is not yet deployed on all systems, so temporary mitigation can involve disabling bpf_wq callbacks or compiling the kernel with BPF JIT disabled to avoid the race condition.

Generated by OpenCVE AI on November 30, 2026 at 21:48 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-362
CWE-416
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Keep a program until its bpf_wq callback has ended bpf_wq_work() runs the callback under rcu_read_lock_trace() only, since the callback may sleep. The program it belongs to need not be sleepable, and such a program is freed behind a plain RCU grace period. The reference that the bpf_wq holds is dropped when the map element goes, or when another callback is set, no matter whether the work is running. If that was the last reference the program is freed under the running callback, and the worker goes on in the freed JIT image: Oops: int3: 0000 [#1] SMP NOPTI RIP: 0010:0xffffffffc0600947 All it takes is to close the map and the program while the callback runs. Note in the program that it has a callback that runs sleepable, and wait for an RCU Tasks Trace grace period, which implies a plain one, before such a program is freed. Let bpf_wq_work() enter its read side critical section before it reads callback_fn. bpf_task_work holds a reference to the program until the callback is done.
Title bpf: Keep a program until its bpf_wq callback has ended
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-362

    Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

  • CWE-416

    Use After Free

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:33 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:18 PM
Modified
Nov 30, 2026, 2:18 PM