7.8

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

Modified
AliasesUBUNTU-CVE-2024-41009DEBIAN-CVE-2024-41009
Published 17-07-2024Last modified 05-08-2026

Vulnerability summary

CVE-2024-41009 is a high (CVSS 7.8) vulnerability in linux. EPSS estimates a 0.27% chance of exploitation in the next 30 days, higher than 19.5% of scored vulnerabilities.

Priority
Routine

Not severe (CVSS 7.8, local access); no exploitation reported by the 5 checked sources

Source freshness unavailable

How is this decided?
CVSS score
7.8/10
010
High · v3.1 (CVE.org)
EPSS score
0.27%
0%100%
Low · 0.00 pp in 30 days
KEVNot listedNot listed by any tracked catalog.
RansomwareNot flaggedNo ransomware use recorded.
Public exploits0No public exploits recorded

Advisory lineage

Upstream 0 · Downstream 36 · Related 26

Timeline

  1. 17-07-2024
    PublishedVulnerability first disclosed.
  2. 05-08-2026
    Last modifiedVulnerability information updated.

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.

CVSS metrics

5 scores · 4 sources · 2 versions

EPSS trend

Probability

0.27%

Chance of exploitation in the next 30 days

Percentile

20%

Versus all other CVEs

30-day change

No change 0.00 pp

From 0.27% on 04-10-2026

04-10-202603-11-2026

Known exploited

Compare KEV catalogs
CISA KEV

Not in the CISA KEV catalog.

ENISA CNW

Not in the ENISA CNW catalog.

CIRCL

Not in the CIRCL catalog.

Public exploits

0 found

No public exploits indexed.

Weaknesses

CWE · root cause

Affected systems

Version check

Known conditions: local access, low-privilege account, no user interaction (CVSS vector). Other conditions: not stated in public data.

Ubuntu117 products
  • linux< 5.15.0-122.132 | < 6.8.0-45.45
  • linux-allwinner-5.19All versions (No fix recorded)
  • linux-aws< 5.15.0-1070.76 | < 6.8.0-1016.17
  • linux-aws-5.0All versions (No fix recorded)
  • linux-aws-5.11All versions (No fix recorded)
Linux2 products
  • linux≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < be35504b959f2749bab280f4671e8df96dcf836f | ≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < 0f98f40eb1ed52af8b81f61901b6c0289ff59de4 | ≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < d1b9df0435bc61e0b44f578846516df8ef476686 | ≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < 511804ab701c0503b72eac08217eabfd366ba069 | ≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < 47416c852f2a04d348ea66ee451cbdcf8119f225 | ≥ 457f44363a8894135c85b7a9afd2bd8196db24ab, < cfa1a2329a691ffd991fcf7248a57d752e712881 | 5.8
  • linux_kernel≥ 5.8, < 6.1.97 | ≥ 6.2, < 6.6.37 | ≥ 6.7, < 6.9.8
Debian1 product
  • linux< 6.1.98-1 | < 6.9.8-1

3 vendors · 120 products

References

23 links
Show all 23 references