CVE-2024-58088: bpf: Fix deadlock when freeing cgroup storage
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix deadlock when freeing cgroup storage
The following commit
bc235cdb423a ("bpf: Prevent deadlock from recursive bpf_task_storage_[get|delete]")
first introduced deadlock prevention for fentry/fexit programs attaching
on bpf_task_storage helpers. That commit also employed the logic in map
free path in its v6 version.
Later bpf_cgrp_storage was first introduced in
c4bcfb38a95e ("bpf: Implement cgroup storage available to non-cgroup-attached bpf progs")
which faces the same issue as bpf_task_storage, instead of its busy
counter, NULL was passed to bpf_local_storage_map_free() which opened
a window to cause deadlock:
<TASK>
(acquiring local_storage->lock)
_raw_spin_lock_irqsave+0x3d/0x50
bpf_local_storage_update+0xd1/0x460
bpf_cgrp_storage_get+0x109/0x130
bpf_prog_a4d4a370ba857314_cgrp_ptr+0x139/0x170
? __bpf_prog_enter_recur+0x16/0x80
bpf_trampoline_6442485186+0x43/0xa4
cgroup_storage_ptr+0x9/0x20
(holding local_storage->lock)
bpf_selem_unlink_storage_nolock.constprop.0+0x135/0x160
bpf_selem_unlink_storage+0x6f/0x110
bpf_local_storage_map_free+0xa2/0x110
bpf_map_free_deferred+0x5b/0x90
process_one_work+0x17c/0x390
worker_thread+0x251/0x360
kthread+0xd2/0x100
ret_from_fork+0x34/0x50
ret_from_fork_asm+0x1a/0x30
</TASK>
Progs:
- A: SEC("fentry/cgroup_storage_ptr")
- cgid (BPF_MAP_TYPE_HASH)
Record the id of the cgroup the current task belonging
to in this hash map, using the address of the cgroup
as the map key.
- cgrpa (BPF_MAP_TYPE_CGRP_STORAGE)
If current task is a kworker, lookup the above hash
map using function parameter @owner as the key to get
its corresponding cgroup id which is then used to get
a trusted pointer to the cgroup through
bpf_cgroup_from_id(). This trusted pointer can then
be passed to bpf_cgrp_storage_get() to finally trigger
the deadlock issue.
- B: SEC("tp_btf/sys_enter")
- cgrpb (BPF_MAP_TYPE_CGRP_STORAGE)
The only purpose of this prog is to fill Prog A's
hash map by calling bpf_cgrp_storage_get() for as
many userspace tasks as possible.
Steps to reproduce:
- Run A;
- while (true) { Run B; Destroy B; }
Fix this issue by passing its busy counter to the free procedure so
it can be properly incremented before storage/smap locking.
Security readout for executives and security teams
Plain-English summary
CVE-2024-58088 is a Linux kernel denial-of-service flaw in BPF cgroup storage handling. A local user with required privileges can trigger a kernel deadlock, potentially making the system unavailable. It does not indicate data theft or privilege escalation in the provided sources.
Executive priority
Schedule normal-priority remediation, raised for shared or multi-tenant Linux systems. The risk is service disruption from a local actor, not remote compromise or data exposure based on the provided evidence.
Technical view
The issue is a deadlock in BPF cgroup local storage free handling. The cgroup storage path passed NULL instead of the busy counter into bpf_local_storage_map_free(), leaving a locking window during map free operations. CVSS is 5.5, local, low complexity, low privileges, availability-only impact.
Likely exposure
Linux systems running affected kernel builds from the vulnerable BPF cgroup storage code path are the main exposure. Practical risk depends on whether local users or workloads can load and run the relevant BPF programs.
Exploitation context
The source describes a reproducible local deadlock scenario using BPF programs, but the bundle marks KEV as false and provides no evidence of active exploitation. Treat this as local availability risk, not confirmed in-the-wild exploitation.
Researcher notes
This is CWE-667 improper locking. The fix direction is to pass the cgroup storage busy counter into the free procedure so locking and recursion prevention align with existing BPF local storage behavior.
Mitigation direction
Update to a Linux kernel or vendor build containing the referenced stable fixes.
Check distribution security advisories for backported fixes before relying on version strings.
Limit untrusted local access to BPF program loading where operationally feasible.
Prioritize shared systems where local users or workloads can exercise BPF features.
Validation and detection
Inventory Linux kernel versions across servers, hosts, and appliances.
Confirm whether vendor kernels include the referenced stable commits or equivalent backports.
Review systems that allow local users or workloads to load BPF programs.
Track availability incidents or kernel hangs on exposed multi-user Linux systems.
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.
cwe · low confidence lookup
CWE-667: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
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.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-667 · source CWE mapping
Improper Locking
Improper Locking represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.