CVE-2026-99018: riscv: entry: gate shadow call stack reload on sstatus.SPP, not tp

Published Oct 23, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

riscv: entry: gate shadow call stack reload on sstatus.SPP, not tp

Under CONFIGSHADOWCALLSTACK, handleexception() reloads the kernel shadow call stack pointer (gp) only when the trap came from userspace. It made that decision with scsloadcurrentiftaskchanged, which compares the trap-time tp (read back from sscratch into s5) against the current tp:

beq \prev, tp, skipscs scsloadcurrent skipscs:

tp is a user-writable register. A user task that sets tp to the linear-map address of its own taskstruct (&current) before trapping makes the comparison succeed (can achieve by brute force with KASLR enable under our test), so the kernel skips scsloadcurrent and keeps running with the gp that userspace left in place. Under CONFIGSHADOWCALLSTACK gp is the shadow call stack pointer and loadglobalpointer is a no-op, so the compiler-emitted "sd ra, -8(gp)" / "ld ra, -8(gp)" in every non-leaf function then write to, and return through, an attacker-controlled address -- an unprivileged kernel arbitrary-write and control-flow-hijack primitive. The poisoned gp is saved to taskstruct.scssp on return, so the reload is skipped on every subsequent entry as well.

Decide "came from userspace" from the hardware sstatus.SPP bit (already in s1 at this point) instead of from tp, mirroring the check that retfromexception already uses a few instructions later. SPP is written by hardware on trap entry and cannot be forged from U-mode. Legitimate behaviour is unchanged: user entries (SPP=0) reload the task shadow call stack, nested kernel entries (SPP=1) skip it.

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Gate shadow call stack pointer reload on the hardware sstatus.SPP bit rather than the user-writable tp register, so kernel entries (SPP=1) skip the reload and user entries (SPP=0) reload the task shadow call stack.

    Linux kernel shadow call stack scs_load_current reload condition = sstatus.SPP

Event History

Oct 23, 2026
CVE Published
via MITRE·12:20 PM
Data Sourced
via MITRE·12:20 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203