# CVE-2024-41009: bpf: Fix overrunning reservations in ringbuf

> 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.33% (percentile 19, 2026-11-26)
- **CWE:** CWE-770
- **Published:** 2024-07-17T06:10:11.351Z
- **Modified:** 2026-08-05T11:34:35.660Z

## Who should check

- Anyone running Linux \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< be35504b959f2749bab280f4671e8df96dcf836f; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 0f98f40eb1ed52af8b81f61901b6c0289ff59de4; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< d1b9df0435bc61e0b44f578846516df8ef476686; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 511804ab701c0503b72eac08217eabfd366ba069; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 47416c852f2a04d348ea66ee451cbdcf8119f225; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< cfa1a2329a691ffd991fcf7248a57d752e712881
- Anyone running Linux 5.8

## Description

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

bpf: Fix overrunning reservations in ringbuf

The BPF ring buffer internally is implemented as a power-of-2 sized circular
buffer, with two logical and ever-increasing counters: consumer\_pos is the
consumer counter to show which logical position the consumer consumed the
data, and producer\_pos which is the producer counter denoting the amount of
data reserved by all producers.

Each time a record is reserved, the producer that "owns" the record will
successfully advance producer counter. In user space each time a record is
read, the consumer of the data advanced the consumer counter once it finished
processing. Both counters are stored in separate pages so that from user
space, the producer counter is read-only and the consumer counter is read-write.

One aspect that simplifies and thus speeds up the implementation of both
producers and consumers is how the data area is mapped twice contiguously
back-to-back in the virtual memory, allowing to not take any special measures
for samples that have to wrap around at the end of the circular buffer data
area, because the next page after the last data page would be first data page
again, and thus the sample will still appear completely contiguous in virtual
memory.

Each record has a struct bpf\_ringbuf\_hdr { u32 len; u32 pg\_off; } header for
book-keeping the length and offset, and is inaccessible to the BPF program.
Helpers like bpf\_ringbuf\_reserve() return \`(void \*)hdr + BPF\_RINGBUF\_HDR\_SZ\`
for the BPF program to use. Bing-Jhong and Muhammad reported that it is however
possible to make a second allocated memory chunk overlapping with the first
chunk and as a result, the BPF program is now able to edit first chunk's
header.

For example, consider the creation of a BPF\_MAP\_TYPE\_RINGBUF map with size
of 0x4000. Next, the consumer\_pos is modified to 0x3000 /before/ a call to
bpf\_ringbuf\_reserve() is made. This will allocate a chunk A, which is in
\[0x0,0x3008\], and the BPF program is able to edit \[0x8,0x3008\]. Now, lets
allocate a chunk B with size 0x3000. This will succeed because consumer\_pos
was edited ahead of time to pass the \`new\_prod\_pos - cons\_pos \> rb-\>mask\`
check. Chunk B will be in range \[0x3008,0x6010\], and the BPF program is able
to edit \[0x3010,0x6010\]. Due to the ring buffer memory layout mentioned
earlier, the ranges \[0x0,0x4000\] and \[0x4000,0x8000\] point to the same data
pages. This means that chunk B at \[0x4000,0x4008\] is chunk A's header.
bpf\_ringbuf\_submit() / bpf\_ringbuf\_discard() use the header's pg\_off to then
locate the bpf\_ringbuf itself via bpf\_ringbuf\_restore\_from\_rec(). Once chunk
B modified chunk A's header, then bpf\_ringbuf\_commit() refers to the wrong
page and could cause a crash.

Fix it by calculating the oldest pending\_pos and check whether the range
from the oldest outstanding record to the newest would span beyond the ring
buffer size. If that is the case, then reject the request. We've tested with
the ring buffer benchmark in BPF selftests (./benchs/run\_bench\_ringbufs.sh)
before/after the fix and while it seems a bit slower on some benchmarks, it
is still not significantly enough to matter.

## Affected and fixed versions

- Linux: \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< be35504b959f2749bab280f4671e8df96dcf836f; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 0f98f40eb1ed52af8b81f61901b6c0289ff59de4; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< d1b9df0435bc61e0b44f578846516df8ef476686; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 511804ab701c0503b72eac08217eabfd366ba069; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 47416c852f2a04d348ea66ee451cbdcf8119f225; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< cfa1a2329a691ffd991fcf7248a57d752e712881 (cvelist)
- Linux: 5.8 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2024-41009.md
Affected: Linux >= 457f44363a8894135c85b7a9afd2bd8196db24ab, < be35504b959f2749bab280f4671e8df96dcf836f; >= 457f44363a8894135c85b7a9afd2bd8196db24ab, < 0f98f40eb1ed52af8b81f61901b6c0289ff59de4; >= 457f44363a8894135c85b7a9afd2bd8196db24ab, < d1b9df0435bc61e0b44f578846516df8ef476686; >= 457f44363a8894135c85b7a…
Fixed in: Linux 0f98f40eb1ed52af8b81f61901b6c0289ff59de4, Linux 511804ab701c0503b72eac08217eabfd366ba069, Linux 47416c852f2a04d348ea66ee451cbdcf8119f225

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-41009 being exploited?

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

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

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

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

Linux \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< be35504b959f2749bab280f4671e8df96dcf836f; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 0f98f40eb1ed52af8b81f61901b6c0289ff59de4; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< d1b9df0435bc61e0b44f578846516df8ef476686; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 511804ab701c0503b72eac08217eabfd366ba069; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< 47416c852f2a04d348ea66ee451cbdcf8119f225; \>= 457f44363a8894135c85b7a9afd2bd8196db24ab, \< cfa1a2329a691ffd991fcf7248a57d752e712881; Linux 5.8.

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

Yes. Fixed in Linux 0f98f40eb1ed52af8b81f61901b6c0289ff59de4, Linux 511804ab701c0503b72eac08217eabfd366ba069, Linux 47416c852f2a04d348ea66ee451cbdcf8119f225. No fix listed yet: follow the vendor advisory.

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

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/d1b9df0435bc61e0b44f578846516df8ef476686>
- patch: <https://git.kernel.org/stable/c/511804ab701c0503b72eac08217eabfd366ba069>
- patch: <https://git.kernel.org/stable/c/47416c852f2a04d348ea66ee451cbdcf8119f225>
- patch: <https://git.kernel.org/stable/c/cfa1a2329a691ffd991fcf7248a57d752e712881>
- other: <https://git.kernel.org/stable/c/be35504b959f2749bab280f4671e8df96dcf836f>
- other: <https://git.kernel.org/stable/c/0f98f40eb1ed52af8b81f61901b6c0289ff59de4>
- other: <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## 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-41009>

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