# CVE-2024-58070: bpf: bpf\_local\_storage: Always use bpf\_mem\_alloc in PREEMPT\_RT

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.23% (percentile 9, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-03-06T15:54:10.166Z
- **Modified:** 2026-08-05T11:47:33.069Z

## Who should check

- Anyone running Linux \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 3392fa605d7c5708c5fbe02e4fbdac547c3b7352; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< b0027500000dfcb8ee952557d565064cea22c43e; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< c1d398a3af7e59d7fef351c84fed7ebb575d1f1a; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1
- Anyone running Linux 6.4

## Description

In the Linux kernel, the following vulnerability has been resolved:

bpf: bpf\_local\_storage: Always use bpf\_mem\_alloc in PREEMPT\_RT

In PREEMPT\_RT, kmalloc(GFP\_ATOMIC) is still not safe in non preemptible
context. bpf\_mem\_alloc must be used in PREEMPT\_RT. This patch is
to enforce bpf\_mem\_alloc in the bpf\_local\_storage when CONFIG\_PREEMPT\_RT
is enabled.

\[   35.118559\] BUG: sleeping function called from invalid context at kernel/locking/spinlock\_rt.c:48
\[   35.118566\] in\_atomic(): 1, irqs\_disabled(): 0, non\_block: 0, pid: 1832, name: test\_progs
\[   35.118569\] preempt\_count: 1, expected: 0
\[   35.118571\] RCU nest depth: 1, expected: 1
\[   35.118577\] INFO: lockdep is turned off.
    ...
\[   35.118647\]  \_\_might\_resched+0x433/0x5b0
\[   35.118677\]  rt\_spin\_lock+0xc3/0x290
\[   35.118700\]  \_\_\_slab\_alloc+0x72/0xc40
\[   35.118723\]  \_\_kmalloc\_noprof+0x13f/0x4e0
\[   35.118732\]  bpf\_map\_kzalloc+0xe5/0x220
\[   35.118740\]  bpf\_selem\_alloc+0x1d2/0x7b0
\[   35.118755\]  bpf\_local\_storage\_update+0x2fa/0x8b0
\[   35.118784\]  bpf\_sk\_storage\_get\_tracing+0x15a/0x1d0
\[   35.118791\]  bpf\_prog\_9a118d86fca78ebb\_trace\_inet\_sock\_set\_state+0x44/0x66
\[   35.118795\]  bpf\_trace\_run3+0x222/0x400
\[   35.118820\]  \_\_bpf\_trace\_inet\_sock\_set\_state+0x11/0x20
\[   35.118824\]  trace\_inet\_sock\_set\_state+0x112/0x130
\[   35.118830\]  inet\_sk\_state\_store+0x41/0x90
\[   35.118836\]  tcp\_set\_state+0x3b3/0x640

There is no need to adjust the gfp\_flags passing to the
bpf\_mem\_cache\_alloc\_flags() which only honors the GFP\_KERNEL.
The verifier has ensured GFP\_KERNEL is passed only in sleepable context.

It has been an old issue since the first introduction of the
bpf\_local\_storage ~5 years ago, so this patch targets the bpf-next.

bpf\_mem\_alloc is needed to solve it, so the Fixes tag is set
to the commit when bpf\_mem\_alloc was first used in the bpf\_local\_storage.

## Affected and fixed versions

- Linux: \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 3392fa605d7c5708c5fbe02e4fbdac547c3b7352; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< b0027500000dfcb8ee952557d565064cea22c43e; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< c1d398a3af7e59d7fef351c84fed7ebb575d1f1a; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1 (cvelist)
- Linux: 6.4 (cvelist)

## Mitigation

- Upgrade Linux to 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-58070. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-58070.md
Affected: Linux >= 08a7ce384e33e53e0732c500a8af67a73f8fceca, < 3392fa605d7c5708c5fbe02e4fbdac547c3b7352; >= 08a7ce384e33e53e0732c500a8af67a73f8fceca, < b0027500000dfcb8ee952557d565064cea22c43e; >= 08a7ce384e33e53e0732c500a8af67a73f8fceca, < c1d398a3af7e59d7fef351c84fed7ebb575d1f1a; >= 08a7ce384e33e53e0732c50…
Fixed in: Linux 3392fa605d7c5708c5fbe02e4fbdac547c3b7352, Linux 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-58070 being exploited?

There is no confirmed exploitation: CVE-2024-58070 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.23% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-58070?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-58070?

Linux \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 3392fa605d7c5708c5fbe02e4fbdac547c3b7352; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< b0027500000dfcb8ee952557d565064cea22c43e; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< c1d398a3af7e59d7fef351c84fed7ebb575d1f1a; \>= 08a7ce384e33e53e0732c500a8af67a73f8fceca, \< 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1; Linux 6.4.

### Is there a fix for CVE-2024-58070?

Yes. Fixed in Linux 3392fa605d7c5708c5fbe02e4fbdac547c3b7352, Linux 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1. Upgrade Linux to 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1 or later.

### How do I check if I'm affected by CVE-2024-58070?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/3392fa605d7c5708c5fbe02e4fbdac547c3b7352>
- patch: <https://git.kernel.org/stable/c/b0027500000dfcb8ee952557d565064cea22c43e>
- patch: <https://git.kernel.org/stable/c/c1d398a3af7e59d7fef351c84fed7ebb575d1f1a>
- patch: <https://git.kernel.org/stable/c/8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-58070>

HTML: <https://flawdb.com/CVE-2024-58070> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-58070>
