bpf: Clamp the trace length in __bpf_get_stack() again
- CVE-2026-143365
- GHSA-pfpc-pjvr-438f
- EUVD-2026-143015
Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Clamp the trace length in __bpf_get_stack() again get_perf_callchain() and get_callchain_entry_for_task() store a trace in a per-CPU entry, one per context. They release the entry before they return it. Thus a second user in the same context can write to the entry while the first user reads it. preempt_disable() stops only other tasks. __bpf_get_stack() requests at most max_depth frames. This is skip plus the frames that fit in the buffer, but not more than perf_event_max_stack. Since the commit below, it copies 'trace->nr - skip' frames with no limit. But a second user can store a longer trace. The unwinders of PowerPC add context markers that max_depth does not limit. In both cases the copy writes after the end of the buffer. Read trace->nr one time. Clamp the value to max_depth before the skip test, as __bpf_get_stack_pe() does. Thus when max_depth is less than skip, the helper returns -EFAULT, and 'trace_nr - skip' does not underflow. The copied frames can still be those of the second user.
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
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 6.19 none stated before 6.19: not affected none stated from 6.12.120 up to 6.12.*: not affected none stated from 6.18.66 up to 6.18.*: not affected none stated from 7.3.7 up to 7.3.*: not affected none stated and 1 more
Product versions from the CVE.org record.
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.