bpf: Clamp the trace length before the skip test in stackid_init()
- CVE-2026-143364
- GHSA-f78g-4cwq-4vc4
- EUVD-2026-143014
Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Clamp the trace length before the skip test in stackid_init() stackid_init() gives a bucket of the stack map min(trace_nr - skip, max_depth - skip) trace entries. Here max_depth is the size of a bucket plus skip, but at most perf_event_max_stack. Context markers can make trace_nr larger than that, so the skip test can pass when max_depth < skip. Then 'max_depth - skip' wraps, and the kernel can write after the bucket. Clamp trace_nr to max_depth before the skip test, as __bpf_get_stack_pe() does. The result changes only when skip >= max_depth. Then it is -EFAULT. Until now skip == max_depth could give the id of an empty trace. get_perf_callchain() releases the trace, so an NMI can change trace->nr. Use READ_ONCE() in bpf_get_stackid(), so the compiler reads it one time.
Text from the CVE.org record.
Recommendation
Linux
- If you run 6.18.xupdate to 6.18.66 or laterPatch update: breaking changes are unlikely
- If you run a version from 6.17.13 to before 6.18update to 6.18 or laterMinor version change: check the release notes
- If you run 6.12.xupdate to 6.12.120 or laterPatch update: breaking changes are unlikely
- If you run a version from 6.6.160 to before 6.7update to 6.7 or laterMinor version change: check the release notes
- If you run a version from 6.1.191 to before 6.2update to 6.2 or laterMinor version change: check the release notes
Some affected versions have no stated fix.
Taken from the version ranges of the CVE.org record. Check the vendor advisory: nothing is said about versions the ranges do not list. Breaking-change risk is read from the version numbers only.
Affected
Linux
Affected versions Fixed in from 6.18.2 to before 6.18.66 6.18.66 from 6.17.13 to before 6.18 6.18 from 6.12.63 to before 6.12.120 6.12.120 from 6.6.160 to before 6.7 6.7 from 6.1.191 to before 6.2 6.2 6.19 none stated before 6.19: not affected none stated from 6.12.120 up to 6.12.*: not affected none stated and 3 more
Product versions from the CVE.org record.
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.