CVE-2026-138870: riscv: cfi: Bounds check restore token before swap
In the Linux kernel, the following vulnerability has been resolved:
riscv: cfi: Bounds check restore token before swap
Currently the user-provided shadow stack restore token is not checked before being used as the address in ssamoswap.d. While an invalid restore token will be caught and raise SIGSEGV, this happens after writing 4 bytes of zeroes anywhere in the address space. Check that the restore token is at least a valid user address before the swap to ensure we do not scribble over kernel memory.
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems running the Linux kernel on RISC-V with Control-Flow Integrity shadow-stack restore handling are exposed when user-provided restore tokens can reach the affected swap operation.
What does an attacker need to exploit it?
An attacker needs to supply an invalid shadow-stack restore token. Before the fix, the token could be used as an address before validation, causing a four-byte zero write before the resulting fault raises SIGSEGV.
What is the impact of a failed restore-token validation?
The invalid token is ultimately detected and causes SIGSEGV, but detection occurs after the kernel has attempted to write four zero bytes at the supplied address. The fix validates that the token is at least a valid user address before the swap, preventing writes to kernel memory.