{"id":"CVE-2026-139451","summary":"bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, arm64: Fix racy plt target update in bpf_arch_text_poke()\n\nWhen a long-jump trampoline is attached to or detached from a bpf prog,\nbpf_arch_text_poke() updates the plt target at the end of the prog by\ntemporarily making the page writable:\n\n\tset_memory_rw(page);\n\tWRITE_ONCE(plt-\u003etarget, plt_target);\n\tset_memory_ro(page);\n\nSince commit 1dad391daef1 (\"bpf, arm64: use bpf_prog_pack for memory\nmanagement\"), bpf progs are allocated from the bpf prog pack, so\nunrelated progs and their plts commonly share a page. The sequence\nabove is not serialized against other pokers, it runs before text_mutex\nis taken and callers only hold the lock of the trampoline being\nupdated. Two CPUs attaching to or detaching from different target progs\nin the same page can therefore race:\n\n\tCPU A                           CPU B\n\tset_memory_rw(page)\n\t                                set_memory_rw(page)\n\t                                WRITE_ONCE(plt_B-\u003etarget, ...)\n\t                                set_memory_ro(page)\n\tWRITE_ONCE(plt_A-\u003etarget, ...)  \u003c- permission fault\n\nThis was hit on an arm64 server with 64K pages while attaching fentry\nprograms to bpf progs:\n\n  Unable to handle kernel write to read-only memory at virtual address ffff80008f46d5f8\n  ESR = 0x000000009600004f\n  FSC = 0x0f: level 3 permission fault\n  pte=00c00200ea5a0783\n  Internal error: Oops: 000000009600004f [#1]  SMP\n  pc : bpf_arch_text_poke+0x214/0x238\n  lr : bpf_arch_text_poke+0x200/0x238\n  Call trace:\n   bpf_arch_text_poke+0x214/0x238 (P)\n   __bpf_trampoline_link_prog+0x1c8/0x470\n   bpf_trampoline_link_prog+0x64/0x90\n   bpf_tracing_prog_attach+0x318/0x4a8\n   bpf_raw_tp_link_attach+0x104/0x258\n   bpf_raw_tracepoint_open+0x6c/0x90\n   __sys_bpf+0x134c/0x3e10\n\nRather than serializing the permission changes, stop changing page\npermissions altogether and write the plt target with\naarch64_insn_write_literal_u64(). It writes through the text patching\nfixmap under patch_lock, the same way the rest of the prog pack is\nwritten, and performs a single-copy atomic 64-bit store. The plt target\nis naturally aligned (see build_plt()), so CPUs concurrently executing\nthe plt still observe either the old or the new target. This is the\nsame helper ftrace and static calls use to update 64-bit literals that\nare loaded concurrently.","modified":"2026-11-30T15:02:28.572606348Z","published":"2026-11-30T13:34:52.647Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139451.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6335e6719fd323c345427b7cf2d5d17c28fdbc41"},{"type":"WEB","url":"https://git.kernel.org/stable/c/cac68ace7b7c6bd695f31d614c2cd980d9287a2f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/f2e7723a7dcd14cbfdf3066c286943dcb2b82709"},{"type":"WEB","url":"https://git.kernel.org/stable/c/fcb7a912873327eb621be0fc12dc147cd2c28d58"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139451.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139451"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"1dad391daef129e01e28206b8d586608ff026548"},{"fixed":"fcb7a912873327eb621be0fc12dc147cd2c28d58"},{"fixed":"f2e7723a7dcd14cbfdf3066c286943dcb2b82709"},{"fixed":"cac68ace7b7c6bd695f31d614c2cd980d9287a2f"},{"fixed":"6335e6719fd323c345427b7cf2d5d17c28fdbc41"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139451.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.9.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139451.json"}}],"schema_version":"1.9.2"}