{"id":"CVE-2026-89580","summary":"bpf: Disable preemption in __bpf_get_stack","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Disable preemption in __bpf_get_stack\n\nget_perf_callchain() returns a per-CPU perf_callchain_entry buffer and\nreleases its recursion slot via put_callchain_entry() before returning,\nso nothing keeps the entry reserved while __bpf_get_stack() consumes\nit below.\n\nA preemptible BPF program (e.g. a non-sleepable raw tracepoint program\non a PREEMPT kernel, which runs under migrate_disable() but not\npreempt_disable()) can be scheduled out between obtaining the entry\nand the copy. Another task scheduled on the same CPU then reuses the\nsame per-CPU buffer and overwrites trace-\u003enr with a larger value.\ncopy_len is then computed from the inflated trace-\u003enr and can exceed\nthe caller's buffer, causing an out-of-bounds write in the memcpy()\nand in the build_id path.\n\nThe rcu_read_lock() taken here alone does not prevent this. It is\nonly taken on the may_fault path, and under CONFIG_PREEMPT_RCU it does\nnot disable preemption; it merely keeps perf's callchain buffer array\nalive (freed via call_rcu()) and does nothing to stop another task\nfrom reusing the entry.\n\nDisable preemption around obtaining the callchain entry and copying\nit into the caller's buffer, so the entry cannot be reused underneath\nus and trace-\u003enr stays bounded by max_depth. Build ID resolution may\nfault and is therefore deferred until after preemption is re-enabled;\nby then the instruction pointers have already been copied into buf,\nso it operates only on that private copy. Note, preempt_disable() also\nsubsumes the buffer-lifetime guarantee the rcu_read_lock() provided,\nsince a preempt-disabled section is an RCU read-side critical section\nfor the callchain buffers' call_rcu() reclaim.\n\n\n[ changed Fixes: commit ]","modified":"2026-09-13T03:47:19.363840223Z","published":"2026-09-11T19:44:46.846Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/89xxx/CVE-2026-89580.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/8c5ba022f2085ea42d011497a6e92e527d123b9b"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9a23747909fcae707990c8466c381a0e7acfaa4e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b1a47b2708d4e95dbd23aee2ec83752190897b3f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/dbfecc8a6631c0d3626c14ba1f1a485a4498445a"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/89xxx/CVE-2026-89580.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-89580"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"c195651e565ae7f41a68acb7d4aa7390ad215de1"},{"fixed":"8c5ba022f2085ea42d011497a6e92e527d123b9b"},{"fixed":"dbfecc8a6631c0d3626c14ba1f1a485a4498445a"},{"fixed":"9a23747909fcae707990c8466c381a0e7acfaa4e"},{"fixed":"b1a47b2708d4e95dbd23aee2ec83752190897b3f"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-89580.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.18.0"},{"fixed":"6.12.109"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.50"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.2.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-89580.json"}}],"schema_version":"1.9.0"}