CVE-2025-40319
Description
In the Linux kernel, the following vulnerability has been resolved:
bpf: Sync pending IRQ work before freeing ring buffer
Fix a race where irq_work can be queued in bpf_ringbuf_commit() but the ring buffer is freed before the work executes. In the syzbot reproducer, a BPF program attached to sched_switch triggers bpf_ringbuf_commit(), queuing an irq_work. If the ring buffer is freed before this work executes, the irq_work thread may accesses freed memory. Calling irq_work_sync(&rb->work) ensures that all pending irq_work complete before freeing the buffer.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A race condition in Linux kernel's BPF ring buffer allows use-after-free when irq_work is queued before buffer freeing, fixed by adding irq_work_sync().
Vulnerability
A race condition exists in the Linux kernel's BPF ring buffer implementation. When bpf_ringbuf_commit() is called, it can queue an irq_work to be executed later. If the ring buffer is freed before this work executes, the irq_work thread may access freed memory, leading to a use-after-free condition [1].
Exploitation
The vulnerability can be triggered by a BPF program attached to the sched_switch tracepoint, which calls bpf_ringbuf_commit(). Under specific timing conditions, the ring buffer can be freed while the irq_work is still pending. No special privileges are required beyond the ability to load and attach BPF programs, which is typically available to unprivileged users in certain configurations [1].
Impact
An attacker who successfully exploits this race condition could cause memory corruption or potentially achieve arbitrary code execution in kernel context. The exact impact depends on the system configuration and the attacker's ability to control the freed memory [1].
Mitigation
The fix, present in kernel stable commits [1][2][3], adds a call to irq_work_sync(&rb->work) before freeing the ring buffer. This ensures that all pending irq_work completes before the buffer is deallocated, eliminating the race condition. Users should apply the latest kernel updates to address this vulnerability.
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
2Patches
747626748a2a0de2ce6b14bc3e1828c7a8d8164511411035410ca3b2eec38430e15544f114e9077638301Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- git.kernel.org/stable/c/10ca3b2eec384628bc9f5d8190aed9427ad2dde6nvd
- git.kernel.org/stable/c/430e15544f11f8de26b2b5109c7152f71b78295envd
- git.kernel.org/stable/c/47626748a2a00068dbbd5836d19076637b4e235bnvd
- git.kernel.org/stable/c/4e9077638301816a7d73fa1e1b4c1db4a7e3b59cnvd
- git.kernel.org/stable/c/6451141103547f4efd774e912418a3b4318046c6nvd
- git.kernel.org/stable/c/de2ce6b14bc3e565708a39bdba3ef9162aeffc72nvd
- git.kernel.org/stable/c/e1828c7a8d8135e21ff6adaaa9458c32aae13b11nvd
News mentions
0No linked articles in our index yet.