{"id":"CVE-2026-99018","title":"riscv: entry: gate shadow call stack reload on sstatus.SPP, not tp","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nriscv: entry: gate shadow call stack reload on sstatus.SPP, not tp\n\nUnder CONFIG_SHADOW_CALL_STACK, handle_exception() reloads the kernel\nshadow call stack pointer (gp)…","severity":"none","vendor":"Linux","product":"Linux","affected":["Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 6639735367a7d491977e9e5e7afc50b489d81d83","Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 7d1367a53137e379498eb8791295e58854378636","Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 37b4401ee6fa06046446d55e97e8d11784080843","Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 4d0697f192975dab5985e921989be1d85cf580e9","Linux 6.7"],"published":"2026-10-23","updated":"2026-10-23","sourceUpdated":"2026-10-23T12:20:54.888Z","source":"CVEORG","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-99018","references":[{"url":"https://git.kernel.org/stable/c/6639735367a7d491977e9e5e7afc50b489d81d83"},{"url":"https://git.kernel.org/stable/c/7d1367a53137e379498eb8791295e58854378636"},{"url":"https://git.kernel.org/stable/c/37b4401ee6fa06046446d55e97e8d11784080843"},{"url":"https://git.kernel.org/stable/c/4d0697f192975dab5985e921989be1d85cf580e9"}],"tags":["cve.org"],"ingestedAt":"2026-10-23T13:24:55.538Z","slug":"CVE-2026-99018","body":"## Overview\n\nIn the Linux kernel, the following vulnerability has been resolved:\n\nriscv: entry: gate shadow call stack reload on sstatus.SPP, not tp\n\nUnder CONFIG_SHADOW_CALL_STACK, handle_exception() reloads the kernel\nshadow call stack pointer (gp) only when the trap came from userspace.\nIt made that decision with scs_load_current_if_task_changed, which\ncompares the trap-time tp (read back from sscratch into s5) against the\ncurrent tp:\n\n\tbeq\t\\prev, tp, _skip_scs\n\tscs_load_current\n_skip_scs:\n\ntp is a user-writable register.  A user task that sets tp to the\nlinear-map address of its own task_struct (&current) before trapping\nmakes the comparison succeed (can achieve by brute force with KASLR\nenable under our test), so the kernel skips scs_load_current and\nkeeps running with the gp that userspace left in place.  Under\nCONFIG_SHADOW_CALL_STACK gp is the shadow call stack pointer and\nload_global_pointer is a no-op, so the compiler-emitted\n\"sd ra, -8(gp)\" / \"ld ra, -8(gp)\" in every non-leaf function then write\nto, and return through, an attacker-controlled address -- an\nunprivileged kernel arbitrary-write and control-flow-hijack primitive.\nThe poisoned gp is saved to task_struct.scs_sp on return, so the reload\nis skipped on every subsequent entry as well.\n\nDecide \"came from userspace\" from the hardware sstatus.SPP bit (already\nin s1 at this point) instead of from tp, mirroring the check that\nret_from_exception already uses a few instructions later.  SPP is\nwritten by hardware on trap entry and cannot be forged from U-mode.\nLegitimate behaviour is unchanged: user entries (SPP=0) reload the task\nshadow call stack, nested kernel entries (SPP=1) skip it.\n\n## Affected\n\n- `Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 6639735367a7d491977e9e5e7afc50b489d81d83`\n- `Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 7d1367a53137e379498eb8791295e58854378636`\n- `Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 37b4401ee6fa06046446d55e97e8d11784080843`\n- `Linux >= d1584d791a297aa8ed93503382a682a6ecfc4218 < 4d0697f192975dab5985e921989be1d85cf580e9`\n- `Linux 6.7`\n\n## Remediation\n\nRefer to the linked advisories for vendor-supplied fixes and affected version ranges.","depth":"sunlit","depthScore":3,"depthScoreParts":{"impact":2.8,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}