CVE-2026-99092 in Linux
Summary
by MITRE • 10/26/2026
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 core_kernel_text() branch of patch_map() on CONFIG_STRICT_KERNEL_RWX, and explicitly left the vmalloc branch unchanged. That branch has a separate problem.
That branch only creates a temporary writable fixmap alias when CONFIG_STRICT_MODULE_RWX is enabled, and otherwise assumes the target is directly writable and returns the address unchanged. That assumption no longer holds: bpf_prog_pack_alloc calls set_memory_rox() on every pack unconditionally in alloc_new_pack(), independently of any CONFIG_STRICT_*_RWX option, so BPF text in the vmalloc area is read-only regardless of what CONFIG_STRICT_MODULE_RWX says.
With CONFIG_STRICT_MODULE_RWX=n, patch_map() returns the read-only address directly, the subsequent copy_to_kernel_nofault() takes a page fault and returns -EFAULT. bpf_arch_text_copy() turns that into -EINVAL, which propagates through bpf_jit_binary_pack_finalize() to the WARN_ON() in bpf_int_jit_compile() and leaves the program un-JITed.
Note that BPF cannot be fixed the way kprobes was in commit bdc46e507b59 ("riscv: mm: make EXECMEM_KPROBES writable without CONFIG_STRICT_MODULE_RWX"). EXECMEM_BPF is already PAGE_KERNEL, i.e. writable at allocation time; the read-only mapping is established afterwards by generic code in alloc_new_pack(), which arch code cannot influence. The only place this can be handled is patch_map().
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: CONFIG_EXECMEM is what actually tracks whether the vmalloc area can hold executable memory that needs a temporary alias to be written. CONFIG_BPF_JIT, CONFIG_KPROBES and CONFIG_MODULES all select it.
Note that this is not limited to CONFIG_MODULES=n. Unlike arm64, riscv selects CONFIG_ARCH_OPTIONAL_KERNEL_RWX, so CONFIG_STRICT_MODULE_RWX can be disabled with CONFIG_MODULES=y as well, and the bug is reachable in that configuration too.
The !CONFIG_MMU build is unaffected: it has its own __patch_insn_set() and __patch_insn_write() implementations and never calls patch_map().
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 10/26/2026
This vulnerability represents a critical flaw in the Linux kernel's RISC-V architecture implementation regarding dynamic code patching, specifically affecting the BPF Just-In-Time compiler. The issue stems from an incorrect assumption within the patch_map function about memory protection states for executable memory regions allocated via vmalloc. When CONFIG_STRICT_MODULE_RWX is disabled, which can occur even with modules enabled due to RISC-V's specific configuration options like ARCH_OPTIONAL_KERNEL_RWX, the kernel incorrectly assumes that BPF program text in the vmalloc area remains writable. In reality, generic code within alloc_new_pack unconditionally applies read-only protections via set_memory_rox regardless of module-related strictness settings. This mismatch between assumed and actual memory permissions leads to immediate operational failures when the kernel attempts to patch JIT-compiled BPF programs.
The technical root cause lies in the conditional logic governing how temporary writable aliases are created for code modification. The original implementation gated the creation of these aliases on CONFIG_STRICT_MODULE_RWX, leaving the vmalloc branch unchanged under the assumption that such memory was inherently writable if strict module protections were off. However, because BPF program packs are explicitly marked as read-only-execute by generic allocation routines independent of kernel-wide or module-specific write-execution policies, this assumption is fundamentally flawed. Consequently, when patch_map returns a read-only address directly instead of establishing a temporary writable mapping, subsequent operations attempting to modify the code trigger page faults.
The operational impact manifests primarily through the failure of BPF program compilation and loading processes. When copy_to_kernel_nofault encounters the protected memory region without an appropriate write alias, it generates an EFAULT error which propagates up the call stack. The bpf_arch_text_copy function translates this into EINVAL errors that ultimately cause the JIT compiler to abort via a warning condition in bpf_int_jit_compile. This results in BPF programs remaining un-JITed, forcing them to run through slower interpreter paths or failing entirely depending on specific runtime conditions. System administrators and developers relying on high-performance packet filtering or tracing capabilities experience degraded performance or complete functional loss of these critical subsystems.
This issue mirrors similar vulnerabilities previously identified and resolved on ARM64 architectures where identical architectural assumptions about executable memory permissions proved incorrect across different configuration scenarios. The resolution requires aligning the RISC-V implementation with established patterns used for kprobes and other dynamic patching mechanisms by utilizing CONFIG_EXECMEM as the definitive indicator of whether vmalloc areas require temporary writable aliases rather than relying on module-specific strictness flags. This approach ensures that all executable memory regions allocated through execmem paths receive proper write permissions during patching operations regardless of broader kernel security configurations regarding modules or general code integrity policies.
Mitigation strategies involve applying the upstream kernel patches that correct this logic by checking CONFIG_EXECMEM status before determining whether to establish temporary writable mappings for BPF JIT compilation targets. System administrators should ensure their kernels are updated with fixes addressing RISC-V patching mechanics specifically related to execmem address handling. Until such updates are applied, workarounds may include disabling strict module write-execute protections if feasible within security constraints or avoiding heavy reliance on complex BPF programs that require frequent runtime modifications until the underlying architectural flaw is addressed through official kernel releases containing these corrections for proper memory permission management during dynamic code patching operations.