{"id":"CVE-2026-98799","title":"bpf: Skip detached progs in trampoline images that are still in use","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Skip detached progs in trampoline images that are still in use\n\nbpf_tramp_image_put() makes sure a trampoline image is not freed while\na task may still be running …","severity":"none","vendor":"Linux","product":"Linux","affected":["Linux >= e21aa341785c679dd409c8cb71f864c00fe6c463 < 967566ad325b42150483e81acb09ea9d800c00b8","Linux >= e21aa341785c679dd409c8cb71f864c00fe6c463 < 17637e1a581a22466ac3620a91e099683ff9cc6f","Linux e21d2b92354b3cd25dd774ebb0f0e52ff04a7861","Linux 85d177f56e5256e14b74a65940f981f6e3e8bb32","Linux >= 5.10.28 < 5.11","Linux >= 5.11.11 < 5.12","Linux 5.12"],"published":"2026-10-18","updated":"2026-10-18","sourceUpdated":"2026-10-18T15:48:44.434Z","source":"CVEORG","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-98799","references":[{"url":"https://git.kernel.org/stable/c/967566ad325b42150483e81acb09ea9d800c00b8"},{"url":"https://git.kernel.org/stable/c/17637e1a581a22466ac3620a91e099683ff9cc6f"}],"tags":["cve.org"],"ingestedAt":"2026-10-18T16:47:32.483Z","slug":"CVE-2026-98799","body":"## Overview\n\nIn the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Skip detached progs in trampoline images that are still in use\n\nbpf_tramp_image_put() makes sure a trampoline image is not freed while\na task may still be running in it, but nothing similar is done for the\nprogs called by that image. Detach drops the last prog reference right\naway and the prog is freed after grace periods, on the basis that a\ntask still in the traced function skips the fexit progs once the nop at\nip_after_call is patched to a jump.\n\nThat leaves out a task sleeping in a sleepable prog that runs before\nthe detached one, which no grace period waits for:\n\n  CPU 0                               CPU 1\n  in image I, sleeping in prog S\n                                      detach P from I's trampoline\n                                       -> new image, bpf_tramp_image_put(I)\n                                      bpf_prog_put(P), last ref\n                                      grace periods, P freed\n  back from S\n  __bpf_prog_enter(P)\n  call P->bpf_func\n\nIf S and P are fexit progs the task is already past the patched jump,\nand fentry only images don't have one. On x86 this is an int3 in\npoisoned bpf_prog_pack memory:\n\n  Oops: int3: 0000 [#1] SMP NOPTI\n  CPU: 18 UID: 0 PID: 94573 Comm: x169 Not tainted 6.18.44 #1 PREEMPT(lazy)\n  RIP: 0010:0xffffffffc0601d8d\n  Call Trace:\n   <TASK>\n   ? bpf_trampoline_6442515411+0x1a4/0x21b\n   bpf_lsm_bprm_committed_creds+0x5/0x10\n   security_bprm_committed_creds+0x5f/0x70\n   begin_new_exec+0x2d6/0x410\n   ...\n\nWe hit this in production when progs attached through trampolines got\ndetached while their hooks were busy, and it was independently found\nwith a fuzzer and KASAN.\n\nHave the JITs emit a patchable nop in front of each prog call sequence\nand record it in the image. When a prog is detached, patch its nop to a\njump over the call sequence. Progs that stay attached keep running for\nthe tasks that are in the image, and ip_after_call isn't needed anymore.\n\nThe task can be in any image that isn't freed yet, not only in the\ncurrent one. It sleeps in image I1 that calls S, P and Q, then P is\ndetached and the trampoline moves to image I2, then Q is detached and\nits call is still in I1. So the trampoline keeps a list of its images\nuntil they are freed, and detaching a prog patches its nop in all of\nthem. Images hold a reference on the trampoline for that long.\n\nOn riscv and loongarch a jump of any range takes several instructions,\nand a task preempted in the middle of them could resume into half of the\nnew sequence. The nop is a single instruction there, patched to a near\nbranch through arch_bpf_trampoline_skip().\n\nWith the extra nops, BPF_MAX_TRAMP_LINKS progs no longer fit in a page\non x86 and arm64 (and already didn't on powerpc), so lower the limit\nthere like s390 does.\n\n## Affected\n\n- `Linux >= e21aa341785c679dd409c8cb71f864c00fe6c463 < 967566ad325b42150483e81acb09ea9d800c00b8`\n- `Linux >= e21aa341785c679dd409c8cb71f864c00fe6c463 < 17637e1a581a22466ac3620a91e099683ff9cc6f`\n- `Linux e21d2b92354b3cd25dd774ebb0f0e52ff04a7861`\n- `Linux 85d177f56e5256e14b74a65940f981f6e3e8bb32`\n- `Linux >= 5.10.28 < 5.11`\n- `Linux >= 5.11.11 < 5.12`\n- `Linux 5.12`\n\n## Remediation\n\nRefer to the linked advisories for vendor-supplied fixes and affected version ranges.","depth":"sunlit","depthScore":3,"depthScoreParts":{"impact":2.8,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}