CVE-2024-41045: bpf: Defer work in bpf_timer_cancel_and_free
In the Linux kernel, the following vulnerability has been resolved:
bpf: Defer work in bpf_timer_cancel_and_free
Currently, the same case as previous patch (two timer callbacks trying
to cancel each other) can be invoked through bpf_map_update_elem as
well, or more precisely, freeing map elements containing timers. Since
this relies on hrtimer_cancel as well, it is prone to the same deadlock
situation as the previous patch.
It would be sufficient to use hrtimer_try_to_cancel to fix this problem,
as the timer cannot be enqueued after async_cancel_and_free. Once
async_cancel_and_free has been done, the timer must be reinitialized
before it can be armed again. The callback running in parallel trying to
arm the timer will fail, and freeing bpf_hrtimer without waiting is
sufficient (given kfree_rcu), and bpf_timer_cb will return
HRTIMER_NORESTART, preventing the timer from being rearmed again.
However, there exists a UAF scenario where the callback arms the timer
before entering this function, such that if cancellation fails (due to
timer callback invoking this routine, or the target timer callback
running concurrently). In such a case, if the timer expiration is
significantly far in the future, the RCU grace period expiration
happening before it will free the bpf_hrtimer state and along with it
the struct hrtimer, that is enqueued.
Hence, it is clear cancellation needs to occur after
async_cancel_and_free, and yet it cannot be done inline due to deadlock
issues. We thus modify bpf_timer_cancel_and_free to defer work to the
global workqueue, adding a work_struct alongside rcu_head (both used at
_different_ points of time, so can share space).
Update existing code comments to reflect the new state of affairs.
Security readout for executives and security teams
Plain-English summary
A flaw in Linux BPF timer cleanup can cause a deadlock or use-after-free when timers and map elements are cancelled concurrently. A local user with sufficient BPF access could potentially crash the system or compromise confidentiality and integrity. Network access alone is not sufficient according to the CVSS vector.
Executive priority
Treat as a high-priority kernel update, especially on multi-user systems where untrusted local users may access BPF functionality. The absence of supported active-exploitation evidence lowers emergency urgency, but the potential confidentiality, integrity, and availability impact warrants prompt remediation.
Technical view
A race in bpf_timer_cancel_and_free can occur while freeing BPF map elements containing timers. Inline hrtimer cancellation may deadlock, while failed cancellation can leave an enqueued timer referencing bpf_hrtimer state freed after an RCU grace period. The kernel fix defers cancellation work to the global workqueue.
Likely exposure
Exposure is limited to Linux systems running affected kernel builds where a local actor can exercise relevant BPF timer and map functionality. The supplied version data names 5.15, 6.9.10, and 6.10 but is not sufficiently clear to determine every affected distribution package.
Exploitation context
The CVSS 3.1 score is 7.8 with a local, low-complexity, low-privilege vector and no user interaction. The supplied record says this CVE is not in KEV, and no cited source establishes active exploitation or a public exploit.
Researcher notes
The vulnerable lifecycle combines asynchronous cancellation, hrtimer state, RCU-delayed freeing, and concurrent callbacks. The source explains both deadlock and use-after-free paths. Distribution backports may make release-number checks unreliable; confirm patch provenance rather than relying only on the displayed kernel version.
Mitigation direction
Install a vendor-supported kernel containing the referenced fix or an equivalent backport.
Check distribution security guidance because the supplied affected-version data is incomplete and ambiguous.
Activate the updated kernel using the distribution's documented procedure.
Validation and detection
Record the running kernel release and distribution package version.
Check the package against the distribution's CVE-2024-41045 advisory or tracker.
Verify the kernel includes either referenced fix or a documented equivalent backport.
Confirm the remediated kernel is running after maintenance.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2024-41045 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.