CVE-2026-138870: Linux kernel RISC-V shadow stack writes four zero bytes at an unchecked restore token

ByLinuxtastic

December 1, 2026 #CVE, #Linux Kernel

Kernel 7.0 added user-space control-flow integrity for RISC-V (the Zicfiss shadow stack), and arch/riscv/kernel/usercfi.c lets a process switch shadow stacks by presenting a restore token. “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.” The fix checks “that the restore token is at least a valid user address before the swap to ensure we do not scribble over kernel memory”. The kernel CNA scores it 7.0 as a high-complexity local bug; Red Hat scores it 7.8, rates it Important, and notes that RHEL does not support RISC-V in production. If a RISC-V host runs a 7.0 to 7.3.3 kernel with CONFIG_RISCV_USER_CFI, upgrade it to 7.3.4 or later and reboot; no other architecture and no kernel before 7.0 is affected.

CVE-2026-138870 at a glance.

ComponentLinux kernel, RISC-V user-space control-flow integrity: the shadow-stack restore-token swap in arch/riscv/kernel/usercfi.c (Zicfiss, CONFIG_RISCV_USER_CFI)
Affected versionsmainline 7.0 up to 7.4-rc1 (from commit 66c9c713); 7.3.x below 7.3.4. Kernels before 7.0 do not have the feature; the record lists no 7.1 or 7.2 stable fix
Fixed inmainline 7.4-rc1 (commit df333b72) and stable 7.3.4; two fix commits in the record. The fix bounds-checks the restore token as a user address before the ssamoswap.d
Severitykernel CNA CVSS 3.1 7.0 High (AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H); NVD Received with no score, CWE or CPE of its own. Red Hat Important, 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H, low complexity), CWE-822 (untrusted pointer dereference), score marked draft; Ubuntu tracker not reachable; SUSE not reachable. The raters differ on how hard a four-byte zero write at a chosen address is to turn into something; the box carries both
Exploited in the wildNot on CISA’s Known Exploited Vulnerabilities list as of 1 December 2026 (catalogue 2026.11.30, released 30 November). EPSS: no score yet on 1 December 2026
Who is exposedRISC-V machines on a 7.0 to 7.3.3 kernel built with user CFI, whose hardware implements Zicfiss and whose user space has shadow stacks enabled: in December 2026 that is development boards and early servers on Fedora, Debian or Ubuntu riscv64 builds, or self-built kernels. The attacker is any local process that can enable a shadow stack for itself and present a token, and the primitive is a four-byte zero write at an address of its choosing in kernel memory. Red Hat: “RHEL does not support RISC-V in production releases, so typical RHEL environments are not exposed”; x86, arm64 and every other architecture do not have the code
PublishedCVE record 30 November 2026 (kernel CNA, updated 1 December); this page built 1 December 2026, last updated 1 December 2026

What it is

A shadow stack is a second stack that holds only return addresses, so that an overwritten return on the ordinary stack is detected when the two disagree. Switching between shadow stacks — for makecontext-style user threads, signal handling or JIT runtimes — is done with a restore token stored at the top of the destination shadow stack, and the ssamoswap.d instruction atomically swaps a value with the word at the token’s address. The kernel does the swap on the process’s behalf, with the token the process gave it.

An address the kernel dereferences on a user’s say-so has to be checked to be a user address first. This one was not: the swap ran, wrote its four zero bytes at the token address, and only then did the fault on an invalid token deliver SIGSEGV. A token pointing into kernel memory is “invalid” in the sense that the process dies afterwards, but the write has already happened, and a zero written at a chosen kernel address is a known escalation primitive: clearing a capability word, a UID, or a check flag. Red Hat classes it as CWE-822 and scores it as a straightforward local privilege escalation; the CNA rates the complexity high, presumably for the work of choosing the address and surviving the signal.

The fix is a bounds check: the token must be at least a valid user address before the swap runs, so a kernel address faults without writing. The feature and the bug arrived together in 7.0, so the affected window is three minor releases of mainline and the 7.3 stable series up to 7.3.3. git.kernel.org refused our reader, so the change is described from the CNA’s copy of the commit message and the one file the record names.

Who is affected on Linux

Each row is what the distribution’s own security tracker said on 1 December 2026; the link in the row is the tracker page, which will be newer than this one.

DistributionStatusFixed package
AlpineNot consulted for this page—
Debianbookworm and trixie not affected (“vulnerable code not present” in the 6.1 and 6.12 kernels); forky and sid fixed; no DSA or DLA on 1 December 2026forky and sid 7.3.6-1 (fix recorded at 7.3.4-1)
UbuntuTracker unreachable on 1 December 2026 (rate limited, then a server error, on two attempts); nothing inferred. No released Ubuntu kernel is at 7.0 or later, so only a mainline build would carry the code—
RHEL, Rocky, Alma, CentOS StreamImportant, 7.8, CWE-822 (bug 2586313); RHEL 10 kernel fix deferred (no supported RISC-V build); not affected on RHEL 6, 7, 8 and 9 and on the OpenShift RHCOS images; no erratanone planned per Red Hat
openSUSE/SLETracker unreachable on 1 December 2026 (client error); nothing inferred. Tumbleweed is the only SUSE kernel that could be at 7.0 or later—
Fedora, Arch; self-built kernelsNot consulted; upstream stable versions apply7.3.4 or later; nothing needed below 7.0 or on any architecture but RISC-V

How to check

Three questions, in order: is this a RISC-V machine on a 7.0 to 7.3.3 kernel, is user CFI built in and does the CPU implement Zicfiss, and do any processes have shadow stacks enabled. Every other architecture, and every kernel outside that window, is done at the first question.

# 1. architecture and kernel: only riscv64 on 7.0, 7.1, 7.2 and 7.3.0-7.3.3
uname -mr

# 2. is user CFI built, and does the hardware have the extension
grep -E 'CONFIG_RISCV_USER_CFI=' /boot/config-$(uname -r) 2>/dev/null
grep -oE 'zicfiss|zicfilp' /proc/cpuinfo | sort -u
dmesg | grep -iE 'cfi|shadow stack' | head

# 3. processes running with a shadow stack (the kernel reports it in the VMA list)
grep -l '\[shadow stack\]' /proc/[0-9]*/maps 2>/dev/null | head

Anything that is not riscv64, or is below 7.0 or at or above 7.3.4, is not affected. A RISC-V host whose config lacks CONFIG_RISCV_USER_CFI, or whose /proc/cpuinfo has no zicfiss, cannot run the swap. The case the score describes is a 7.3 host with the extension and the option, where any local process can enable a shadow stack for itself with prctl() and present a token; whether any process already does is beside the point, since the attacker brings its own.

How to fix it

Install 7.3.4 or later and reboot; a kernel bug is not patched in place and the swap code stays in memory until the machine boots the new image. Debian forky and sid carried 7.3.6 on 1 December 2026; Fedora and Arch riscv64 builds track upstream closely; no enterprise distribution ships a supported RISC-V kernel in the affected window.

# Debian forky / sid (riscv64)
apt update && apt install linux-image-riscv64 && systemctl reboot
# Fedora, Arch and self-built 7.x kernels
dnf upgrade kernel && systemctl reboot
pacman -Syu linux && systemctl reboot
uname -r

# until then: a kernel built without the option cannot be reached; rebuilding is the only mitigation
# (there is no runtime switch for user CFI once the kernel has it)

There is no runtime mitigation: user CFI has no sysctl, and the token check is in the kernel’s own path, so a host that must stay up on an affected kernel either rebuilds without CONFIG_RISCV_USER_CFI or accepts that any local user can zero four bytes of kernel memory. What not to do: do not disable the feature on a fixed kernel because of this record; the shadow stack is a mitigation worth keeping, and the bug was in the switch, not the stack.

Sources

  • CVE-2026-138870 at CVE.org — the kernel CNA record (30 November 2026, updated 1 December when the CNA added its CVSS 3.1 metric): the commit message, the git and version ranges, CVSS 3.1 7.0
  • Fix commits on git.kernel.org: df333b72, 34dbcdd0; git.kernel.org refuses automated readers, so the diffs were not read for this page and the fix is described from the CNA’s copy of the commit message and the file the record names
  • NVD entry — Received on 30 November, carrying the CNA’s ranges; no NVD score, CWE or CPE on 1 December
  • Distribution trackers: Debian (bookworm and trixie not affected, forky and sid fixed) · Ubuntu (unreachable on 1 December) · Red Hat (Important 7.8, CWE-822, RHEL 10 fix deferred, others not affected) · SUSE (unreachable on 1 December)
  • CISA KEV catalogue 2026.11.30, not listed · EPSS: no score for this CVE on 1 December 2026

Related reading

This advisory page was assembled from the primary sources listed above on 1 December 2026 and is updated when they change. The facts are theirs; the checks and the ordering are ours. If a row in the distribution table is out of date, the tracker link in that row is the current word.