CVE-2026-139345

bpf: Prevent task work context reuse while irq_work is busy

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: Prevent task work context reuse while irq_work is busy

A bpf_task_work context can return to STANDBY before its scheduling
irq_work handler returns. Both callback completion and task_work_add()
failure can publish STANDBY while the irq_work is still BUSY. A new
round can then reinitialize and queue the same irq_work on another CPU
while the old handler is still running.

One concrete interleaving is:

1. CPU 0 successfully queues ctx->work with task_work_add() and pauses
before its SCHEDULING-to-SCHEDULED cmpxchg.

2. The target task on CPU 1 completes the callback, resets ctx->task
and publishes STANDBY.

3. CPU 2 starts a new round, changes STANDBY to PENDING and queues the
same irq_work. The new handler changes PENDING to SCHEDULING, but
task_work_add() returns -ESRCH because its target task has exited.
The handler has not yet reset the context or rolled back the state.

4. CPU 0 resumes and changes the new round's SCHEDULING to SCHEDULED,
even though no task work was queued for that round.

5. The new handler resets ctx->task, but its SCHEDULING-to-STANDBY
cmpxchg fails. The context remains SCHEDULED with a NULL task, and
subsequent attempts to acquire this context fail with -EBUSY.

6. Map-value deletion observes SCHEDULED and queues asynchronous
cancellation, which passes the NULL ctx->task to task_work_cancel().

Overlapping invocations also share one BUSY bit. An invocation can clear
that bit while the other invocation is still running.

Initialize the scheduling irq_work when the context is created and stop
reinitializing it for each round. After claiming the context with the
STANDBY-to-PENDING cmpxchg, check BUSY and reject reuse with -EBUSY if a
previous invocation is still in progress. Checking after the cmpxchg
orders the BUSY read after the STANDBY publication.

No irq_work has been queued for the attempted round at this point, so
the rejection can roll PENDING back to STANDBY. Use cmpxchg for that
rollback to preserve FREED if a concurrent deletion has published it.
Once BUSY clears, scheduling can be retried.

Analysis

AI-generated

Technical impact

This vulnerability arises in the Linux kernel’s BPF task work subsystem, where a race condition can let a task work context be reused while an irq_work handler remains active. The resulting state corruption causes subsequent operations to fail with errors such as –EBUSY and can leave stale data in scheduling queues, potentially leading to denial of service. The weakness is a concurrency race that compromises kernel scheduling integrity.

Affected Systems

The issue affects all Linux kernel releases that contain the bpf_task_work implementation; the CVE data does not specify particular patch levels or version ranges, so any kernel deriving the affected code can be vulnerable.

Risk and Exploitability

Exploit requires privileged access that can inject BPF programs or otherwise trigger concurrent task work and irq_work cycles. Because the flaw is a kernel race condition, an attacker with kernel or root privileges could induce a denial of service by causing task completions to stall or by corrupting internal state. The EPSS score is not available and the vulnerability is not listed in CISA KEV, but the lack of a published fix at the time of this analysis leaves the risk unmitigated until the patch is applied.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update the Linux kernel to a version that includes the commit that initializes the scheduling irq_work at context creation and rejects reuse with –EBUSY.
  • If an updated kernel is unavailable, consider disabling or restricting BPF task work features or the module that relies on it until the fix is deployed.
  • Continuously monitor system logs for –EBUSY errors or warnings about task work cancellation; treat such events as indicators that the race condition may still be operative until the kernel update is applied.

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

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-617
CWE-665
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Prevent task work context reuse while irq_work is busy A bpf_task_work context can return to STANDBY before its scheduling irq_work handler returns. Both callback completion and task_work_add() failure can publish STANDBY while the irq_work is still BUSY. A new round can then reinitialize and queue the same irq_work on another CPU while the old handler is still running. One concrete interleaving is: 1. CPU 0 successfully queues ctx->work with task_work_add() and pauses before its SCHEDULING-to-SCHEDULED cmpxchg. 2. The target task on CPU 1 completes the callback, resets ctx->task and publishes STANDBY. 3. CPU 2 starts a new round, changes STANDBY to PENDING and queues the same irq_work. The new handler changes PENDING to SCHEDULING, but task_work_add() returns -ESRCH because its target task has exited. The handler has not yet reset the context or rolled back the state. 4. CPU 0 resumes and changes the new round's SCHEDULING to SCHEDULED, even though no task work was queued for that round. 5. The new handler resets ctx->task, but its SCHEDULING-to-STANDBY cmpxchg fails. The context remains SCHEDULED with a NULL task, and subsequent attempts to acquire this context fail with -EBUSY. 6. Map-value deletion observes SCHEDULED and queues asynchronous cancellation, which passes the NULL ctx->task to task_work_cancel(). Overlapping invocations also share one BUSY bit. An invocation can clear that bit while the other invocation is still running. Initialize the scheduling irq_work when the context is created and stop reinitializing it for each round. After claiming the context with the STANDBY-to-PENDING cmpxchg, check BUSY and reject reuse with -EBUSY if a previous invocation is still in progress. Checking after the cmpxchg orders the BUSY read after the STANDBY publication. No irq_work has been queued for the attempted round at this point, so the rejection can roll PENDING back to STANDBY. Use cmpxchg for that rollback to preserve FREED if a concurrent deletion has published it. Once BUSY clears, scheduling can be retried.
Title bpf: Prevent task work context reuse while irq_work is busy
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

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