CVE-2026-99092: riscv: patch: fix handling of bpf-jit execmem addresses
In the Linux kernel, the following vulnerability has been resolved:
riscv: patch: fix handling of bpf-jit execmem addresses
Commit 8718e5a3090b ("riscv: patch: skip fixmap mapping when kernel text is already writable") gated the corekerneltext() branch of patchmap() on CONFIGSTRICTKERNELRWX, and explicitly left the vmalloc branch unchanged. That branch has a separate problem.
That branch only creates a temporary writable fixmap alias when CONFIGSTRICTMODULERWX is enabled, and otherwise assumes the target is directly writable and returns the address unchanged. That assumption no longer holds: bpfprogpackalloc calls setmemoryrox() on every pack unconditionally in allocnewpack(), independently of any CONFIGSTRICTRWX option, so BPF text in the vmalloc area is read-only regardless of what CONFIGSTRICTMODULERWX says.
With CONFIGSTRICTMODULERWX=n, patchmap() returns the read-only address directly, the subsequent copytokernelnofault() takes a page fault and returns -EFAULT. bpfarchtextcopy() turns that into -EINVAL, which propagates through bpfjitbinarypackfinalize() to the WARNON() in bpfintjitcompile() and leaves the program un-JITed.
Note that BPF cannot be fixed the way kprobes was in commit bdc46e507b59 ("riscv: mm: make EXECMEMKPROBES writable without CONFIGSTRICTMODULERWX"). EXECMEMBPF is already PAGEKERNEL, i.e. writable at allocation time; the read-only mapping is established afterwards by generic code in allocnewpack(), which arch code cannot influence. The only place this can be handled is patchmap().
This is the same problem that was fixed on arm64 by commit b1480ed230ac ("arm64: patching: fix handling of execmem addresses"), and the fix is the same: CONFIGEXECMEM is what actually tracks whether the vmalloc area can hold executable memory that needs a temporary alias to be written. CONFIGBPFJIT, CONFIGKPROBES and CONFIGMODULES all select it.
Note that this is not limited to CONFIGMODULES=n. Unlike arm64, riscv selects CONFIGARCHOPTIONALKERNELRWX, so CONFIGSTRICTMODULERWX can be disabled with CONFIGMODULES=y as well, and the bug is reachable in that configuration too.
The !CONFIGMMU build is unaffected: it has its own patchinsnset() and patchinsnwrite() implementations and never calls patchmap().
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.115-2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.2.11-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.115-2~deb12u1 - Upgrade
Upgrade
ubuntu/linux-aws-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1017.18~24.04.1 - Upgrade
Upgrade
ubuntu/linux-azure-fde-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1019.19~24.04.1 - Upgrade
Upgrade
ubuntu/linux-gcp-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1017.19~24.04.1 - Upgrade
Upgrade
ubuntu/linux-hwe-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-43.43~24.04.1 - Upgrade
Upgrade
ubuntu/linux-oracle-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1016.18~24.04.1 - Upgrade
Upgrade
ubuntu/linux-riscv-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-43.43.1~24.04.2 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 7.3.0-10.10 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-azureto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-azure-fdeto a version that resolves this vulnerability.Fixed in 7.3.0-1004.5 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-raspito a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-realtimeto a version that resolves this vulnerability.Fixed in 7.3.0-10.10.1 - Upgrade
Upgrade
ubuntu/linux-riscvto a version that resolves this vulnerability.Fixed in 7.3.0-10.10.1 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 7.0.0-43.43 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 7.0.0-1017.18 - Upgrade
Upgrade
ubuntu/linux-azureto a version that resolves this vulnerability.Fixed in 7.0.0-1020.21 - Upgrade
Upgrade
ubuntu/linux-azure-fdeto a version that resolves this vulnerability.Fixed in 7.0.0-1019.19 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 7.0.0-1017.19 - Upgrade
Upgrade
ubuntu/linux-gketo a version that resolves this vulnerability.Fixed in 7.0.0-1010.11 - Upgrade
Upgrade
ubuntu/linux-ibmto a version that resolves this vulnerability.Fixed in 7.0.0-1018.18 - Upgrade
Upgrade
ubuntu/linux-oem-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1018.18 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 7.0.0-1016.18 - Upgrade
Upgrade
ubuntu/linux-raspito a version that resolves this vulnerability.Fixed in 7.0.0-1023.23 - Upgrade
Upgrade
ubuntu/linux-realtimeto a version that resolves this vulnerability.Fixed in 7.0.0-43.43.1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.192-2Fixed in 6.12.117-1Fixed in 7.2.15-1Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.117-1~deb12u1
Event History
Frequently Asked Questions
Which kernel configurations are affected by this failure?
The failure occurs when CONFIG_STRICT_MODULE_RWX is disabled. In that configuration, patch_map() treats the vmalloc target as directly writable even though BPF program packs have been made read-only and executable.
How can I tell whether this issue is occurring on a system?
BPF JIT compilation can fail when copying to the BPF JIT text returns -EFAULT, which is converted to -EINVAL. The failure propagates to a WARN_ON() in bpf_int_jit_compile(), and the affected program is left un-JITed.