{"id":"CVE-2026-139451","aliases":["CVE-2026-139451"],"related":[],"kind":"vulnerability","state":"published","title":"bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()","summary":"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->target, 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->target, ...)\n\t                                set_memory_ro(page)\n\tWRITE_ONCE(plt_A->target, ...)  <- 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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->target, 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->target, ...)\n\t                                set_memory_ro(page)\n\tWRITE_ONCE(plt_A->target, ...)  <- 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.","source":"cvelist"}],"published":"2026-11-30T13:34:52.647Z","modified":"2026-11-30T14:19:16.070Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"1dad391daef129e01e28206b8d586608ff026548","fixed":"fcb7a912873327eb621be0fc12dc147cd2c28d58","status":"affected"},{"type":"git","introduced":"1dad391daef129e01e28206b8d586608ff026548","fixed":"f2e7723a7dcd14cbfdf3066c286943dcb2b82709","status":"affected"},{"type":"git","introduced":"1dad391daef129e01e28206b8d586608ff026548","fixed":"cac68ace7b7c6bd695f31d614c2cd980d9287a2f","status":"affected"},{"type":"git","introduced":"1dad391daef129e01e28206b8d586608ff026548","fixed":"6335e6719fd323c345427b7cf2d5d17c28fdbc41","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.9","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.9","status":"unaffected"},{"type":"semver","introduced":"6.12.120","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.65","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.6","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/fcb7a912873327eb621be0fc12dc147cd2c28d58","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f2e7723a7dcd14cbfdf3066c286943dcb2b82709","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cac68ace7b7c6bd695f31d614c2cd980d9287a2f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6335e6719fd323c345427b7cf2d5d17c28fdbc41","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-139451","url":"https://www.cve.org/CVERecord?id=CVE-2026-139451","licence":"CVE Terms of Use","modified":"2026-11-30T13:34:52.647Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-139451","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139451","licence":"Public domain","modified":"2026-11-30T14:19:16.070Z"}],"updatedAt":"2026-11-30T14:33:00.161Z","epss":{"score":0.00201,"percentile":0.10478,"date":"2026-12-01T12:00:22.000Z"}}