{"id":"CVE-2026-139451","state":"PUBLISHED","title":"bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()","description":"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.","publishedAt":"2026-11-30T13:34:52.647Z","updatedAt":"2026-11-30T13:34:52.647Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"fcb7a912873327eb621be0fc12dc147cd2c28d58","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"f2e7723a7dcd14cbfdf3066c286943dcb2b82709","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"cac68ace7b7c6bd695f31d614c2cd980d9287a2f","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"6335e6719fd323c345427b7cf2d5d17c28fdbc41","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_jit_comp.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.9","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.9","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_jit_comp.c"]}],"references":["https://git.kernel.org/stable/c/fcb7a912873327eb621be0fc12dc147cd2c28d58","https://git.kernel.org/stable/c/f2e7723a7dcd14cbfdf3066c286943dcb2b82709","https://git.kernel.org/stable/c/cac68ace7b7c6bd695f31d614c2cd980d9287a2f","https://git.kernel.org/stable/c/6335e6719fd323c345427b7cf2d5d17c28fdbc41"],"weaknesses":[],"ingestedAt":"2026-11-30T13:50:04.417Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139451.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139451","state":"PUBLISHED","datePublished":"2026-11-30T13:34:52.647Z","dateUpdated":"2026-11-30T13:34:52.647Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.934Z"},"containers":{"cna":{"title":"bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"fcb7a912873327eb621be0fc12dc147cd2c28d58","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"f2e7723a7dcd14cbfdf3066c286943dcb2b82709","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"cac68ace7b7c6bd695f31d614c2cd980d9287a2f","versionType":"git"},{"version":"1dad391daef129e01e28206b8d586608ff026548","status":"affected","lessThan":"6335e6719fd323c345427b7cf2d5d17c28fdbc41","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_jit_comp.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.9","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.9","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/arm64/net/bpf_jit_comp.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/fcb7a912873327eb621be0fc12dc147cd2c28d58"},{"url":"https://git.kernel.org/stable/c/f2e7723a7dcd14cbfdf3066c286943dcb2b82709"},{"url":"https://git.kernel.org/stable/c/cac68ace7b7c6bd695f31d614c2cd980d9287a2f"},{"url":"https://git.kernel.org/stable/c/6335e6719fd323c345427b7cf2d5d17c28fdbc41"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:34:52.647Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}