Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792759204; b=MTWyC+HNsLWeuE+ou7Q3OnCeeUihADFZSr3+6CbV3kYl4MvKR5uiGVQZOsoD6pk42Z0a hVEQ9vdhImrw+8otfT7yCi+6iXpHqB7Ssd00pBNd0sS8LF15qy2zS76AjbdRxzl4uCwpk Mi3kjtu3zkLmP4rKhdmG1C4ZmMUoctbrhWutCWyYF1c03eKP9h0Ur04bvVgTwogv+xfTp 92jiAJ0Q1kGZMVe9BW2Y6hvMjLEIGoqQsyQt31O2p6sLJz+F/Lsz93AZ4GTy/Xo9rXNBr NDo2dAKIZx9AU0JLYJMUC60NWtHk4sAW+yg6sys4df6ai2sU/ce4XjH5Ij4679pW9FA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792759204; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:Lines:X-Developer-Signature:X-Developer-Key: Content-Transfer-Encoding; bh=1mA8V+wVwCmm4UVm099+VV+MV7qXVu94OnJThM/QqQ8=; b=Fo3dKfSb7hTBAvqka096rP5XWxf4yKndyBjt+DHgbjGeexGc/JJZVACni3I1i5gNvrgM KKGQpeE5IZlQb4sGE/h+nb5QyuzHfxbBWAVzehBg3jY5dxWhWH+q6onZ1hN0jEau5NkQW q632DhVei4or8/e2bePyXI9HuEe7/4/X6OAEWaIFVknU+93j8Jol3RwDepMWJPyLDk3XB 8vzZX6PIYyBfugJVLA4NapWiXyBv0HLvBrFmresnqcKYeCpyG2fS5BMO00tdWMTH10z+6 2DyU0ItqbW3YYeacDLHBx03FmINy+iIF2OjhMyamck3H+FxVefTH9A05PwipbUeFHcA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=1S46rxNL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3992606A31B for ; Fri, 23 Oct 2026 12:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=1S46rxNL Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1E0D1F01825; Fri, 23 Oct 2026 12:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792759203; bh=1mA8V+wVwCmm4UVm099+VV+MV7qXVu94OnJThM/QqQ8=; h=From:To:Cc:Subject:Date:Reply-To; b=1S46rxNL+R8hBsqNuiW+Yda8H2Wz7A4kit07fdY6DHwWRcQwPR+0xMfXCKqHnbe69 kSl10tP/pmg+2u7Q9FHrjnK0IRqjwfvqx9wcvbYjbLa70KEiQQqdEnfTtC0P+CBe3/ eWmJViYsIkqMS/rnZPAww5k5zEUXYGXscJlDh1NI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99018: riscv: entry: gate shadow call stack reload on sstatus.SPP, not tp Date: Fri, 23 Oct 2026 14:20:20 +0200 Message-ID: <2026102321-CVE-2026-99018-4efc@gregkh> X-Mailer: git-send-email 2.56.0 Reply-To: , X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3812; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=pMVkVBz3rf/aQt3ExnysI91Q73yFC8tq2+EU5Csrbcw=; b=owGbwMvMwCRo6H6F97bub03G02pJDFm3A042LvBfv+p8ztsJIa5cor6PF9kcbRdSvXR036XZm yYcN/dp6IhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ9FxlWNAewX72zaOC5Ppz 7x8wH54+5e7RlawM8/RC6myT5WdF60wXnz93+azruZPrtgAA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: riscv: entry: gate shadow call stack reload on sstatus.SPP, not tp Under CONFIG_SHADOW_CALL_STACK, handle_exception() reloads the kernel shadow call stack pointer (gp) only when the trap came from userspace. It made that decision with scs_load_current_if_task_changed, which compares the trap-time tp (read back from sscratch into s5) against the current tp: beq \prev, tp, _skip_scs scs_load_current _skip_scs: tp is a user-writable register. A user task that sets tp to the linear-map address of its own task_struct (¤t) before trapping makes the comparison succeed (can achieve by brute force with KASLR enable under our test), so the kernel skips scs_load_current and keeps running with the gp that userspace left in place. Under CONFIG_SHADOW_CALL_STACK gp is the shadow call stack pointer and load_global_pointer 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 task_struct.scs_sp 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 ret_from_exception 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. The Linux kernel CVE team has assigned CVE-2026-99018 to this issue. Affected and fixed versions =========================== Issue introduced in 6.7 with commit d1584d791a297aa8ed93503382a682a6ecfc4218 and fixed in 6.12.113 with commit 6639735367a7d491977e9e5e7afc50b489d81d83 Issue introduced in 6.7 with commit d1584d791a297aa8ed93503382a682a6ecfc4218 and fixed in 6.18.57 with commit 7d1367a53137e379498eb8791295e58854378636 Issue introduced in 6.7 with commit d1584d791a297aa8ed93503382a682a6ecfc4218 and fixed in 7.2.11 with commit 37b4401ee6fa06046446d55e97e8d11784080843 Issue introduced in 6.7 with commit d1584d791a297aa8ed93503382a682a6ecfc4218 and fixed in 7.3 with commit 4d0697f192975dab5985e921989be1d85cf580e9 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-99018 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: arch/riscv/include/asm/scs.h arch/riscv/kernel/entry.S Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/6639735367a7d491977e9e5e7afc50b489d81d83 https://git.kernel.org/stable/c/7d1367a53137e379498eb8791295e58854378636 https://git.kernel.org/stable/c/37b4401ee6fa06046446d55e97e8d11784080843 https://git.kernel.org/stable/c/4d0697f192975dab5985e921989be1d85cf580e9