CVE-2026-139451

bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()

Published Nov 30, 2026 CVSS n/a EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()

When a long-jump trampoline is attached to or detached from a bpf prog,
bpf_arch_text_poke() updates the plt target at the end of the prog by
temporarily making the page writable:

set_memory_rw(page);
WRITE_ONCE(plt->target, plt_target);
set_memory_ro(page);

Since commit 1dad391daef1 ("bpf, arm64: use bpf_prog_pack for memory
management"), bpf progs are allocated from the bpf prog pack, so
unrelated progs and their plts commonly share a page. The sequence
above is not serialized against other pokers, it runs before text_mutex
is taken and callers only hold the lock of the trampoline being
updated. Two CPUs attaching to or detaching from different target progs
in the same page can therefore race:

CPU A CPU B
set_memory_rw(page)
set_memory_rw(page)
WRITE_ONCE(plt_B->target, ...)
set_memory_ro(page)
WRITE_ONCE(plt_A->target, ...) <- permission fault

This was hit on an arm64 server with 64K pages while attaching fentry
programs to bpf progs:

Unable to handle kernel write to read-only memory at virtual address ffff80008f46d5f8
ESR = 0x000000009600004f
FSC = 0x0f: level 3 permission fault
pte=00c00200ea5a0783
Internal error: Oops: 000000009600004f [#1] SMP
pc : bpf_arch_text_poke+0x214/0x238
lr : bpf_arch_text_poke+0x200/0x238
Call trace:
bpf_arch_text_poke+0x214/0x238 (P)
__bpf_trampoline_link_prog+0x1c8/0x470
bpf_trampoline_link_prog+0x64/0x90
bpf_tracing_prog_attach+0x318/0x4a8
bpf_raw_tp_link_attach+0x104/0x258
bpf_raw_tracepoint_open+0x6c/0x90
__sys_bpf+0x134c/0x3e10

Rather than serializing the permission changes, stop changing page
permissions altogether and write the plt target with
aarch64_insn_write_literal_u64(). It writes through the text patching
fixmap under patch_lock, the same way the rest of the prog pack is
written, and performs a single-copy atomic 64-bit store. The plt target
is naturally aligned (see build_plt()), so CPUs concurrently executing
the plt still observe either the old or the new target. This is the
same helper ftrace and static calls use to update 64-bit literals that
are loaded concurrently.

Analysis

AI-generated

Technical impact

A race condition arises in the Linux kernel’s BPF subsystem when a long-jump trampoline is attached to or detached from a BPF program on arm64. The function bpf_arch_text_poke() temporarily changes page permissions to write to a PLT target, but this change is not serialized with other writers or with the text mutex. As a result, two CPUs that operate on PLT entries belonging to different BPF programs on the same page can simultaneously toggle page permissions and perform stores, causing a permission fault and a kernel Oops that crashes the system. This manifests as a write to read‑only memory and results in a denial of service.

Affected Systems

Affected systems are Linux kernel versions running on the ARM64 architecture that employ the BPF subsystem and rely on long‑jump trampoline logic within the bpf_arch_text_poke() function. All ARM64 kernels with this code path—particularly those that load or detach BPF programs that use long‑jump trampolines—are potentially vulnerable. The exact range of affected releases is not specified, so any in‑use kernel with that implementation is at risk.

Risk and Exploitability

Based on the description, it is inferred that the flaw requires local privileged code execution to load or detach BPF programs and that two CPUs simultaneously manipulating PLT entries on the same page can trigger the race. The EPSS score is <1%, and the vulnerability is not in the CISA KEV catalog. The kernel crash observed in the reported crash trace confirms that the bug can be triggered by privileged users who have the ability to attach or detach BPF programs. Because the race is challenging to time precisely, the exploitability is considered moderate; however, the impact remains high due to the kernel crash that results in a local denial of service.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply a kernel update that incorporates the patch removing page permission changes and replacing the PLT write with aarch64_insn_write_literal_u64().
  • Until an updated kernel is available, limit concurrent attachment and detachment of BPF programs by serializing those operations or disabling parallel BPF management in the system configuration.
  • Monitor kernel logs for "kernel write to read‑only memory" errors and restart the system promptly if a crash occurs, as a temporary measure to contain denial of service.

Generated by OpenCVE AI on December 1, 2026 at 19:18 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-362
Type Values Removed Values Added
Weaknesses CWE-362
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf, arm64: Fix racy plt target update in bpf_arch_text_poke() When a long-jump trampoline is attached to or detached from a bpf prog, bpf_arch_text_poke() updates the plt target at the end of the prog by temporarily making the page writable: set_memory_rw(page); WRITE_ONCE(plt->target, plt_target); set_memory_ro(page); Since commit 1dad391daef1 ("bpf, arm64: use bpf_prog_pack for memory management"), bpf progs are allocated from the bpf prog pack, so unrelated progs and their plts commonly share a page. The sequence above is not serialized against other pokers, it runs before text_mutex is taken and callers only hold the lock of the trampoline being updated. Two CPUs attaching to or detaching from different target progs in the same page can therefore race: CPU A CPU B set_memory_rw(page) set_memory_rw(page) WRITE_ONCE(plt_B->target, ...) set_memory_ro(page) WRITE_ONCE(plt_A->target, ...) <- permission fault This was hit on an arm64 server with 64K pages while attaching fentry programs to bpf progs: Unable to handle kernel write to read-only memory at virtual address ffff80008f46d5f8 ESR = 0x000000009600004f FSC = 0x0f: level 3 permission fault pte=00c00200ea5a0783 Internal error: Oops: 000000009600004f [#1] SMP pc : bpf_arch_text_poke+0x214/0x238 lr : bpf_arch_text_poke+0x200/0x238 Call trace: bpf_arch_text_poke+0x214/0x238 (P) __bpf_trampoline_link_prog+0x1c8/0x470 bpf_trampoline_link_prog+0x64/0x90 bpf_tracing_prog_attach+0x318/0x4a8 bpf_raw_tp_link_attach+0x104/0x258 bpf_raw_tracepoint_open+0x6c/0x90 __sys_bpf+0x134c/0x3e10 Rather than serializing the permission changes, stop changing page permissions altogether and write the plt target with aarch64_insn_write_literal_u64(). It writes through the text patching fixmap under patch_lock, the same way the rest of the prog pack is written, and performs a single-copy atomic 64-bit store. The plt target is naturally aligned (see build_plt()), so CPUs concurrently executing the plt still observe either the old or the new target. This is the same helper ftrace and static calls use to update 64-bit literals that are loaded concurrently.
Title bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

No weakness.

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:34 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM