Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscv/kernel: update __show_regs() to print shadow stack register

Update __show_regs() to print the captured shadow stack pointer. On
tasks where shadow stack is disabled, simply print 0.

Signed-off-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Andreas Korb <andreas.korb@aisec.fraunhofer.de> # QEMU, custom CVA6
Tested-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Link: https://patch.msgid.link/20251112-v5_user_cfi_series-v23-18-b55691eacf4f@rivosinc.com
[pjw@kernel.org: cleaned up patch description]
Signed-off-by: Paul Walmsley <pjw@kernel.org>

authored by

Deepak Gupta and committed by
Paul Walmsley
9d0e75e2 66c9c713

+2 -2
+2 -2
arch/riscv/kernel/process.c
··· 93 93 regs->s8, regs->s9, regs->s10); 94 94 pr_cont(" s11: " REG_FMT " t3 : " REG_FMT " t4 : " REG_FMT "\n", 95 95 regs->s11, regs->t3, regs->t4); 96 - pr_cont(" t5 : " REG_FMT " t6 : " REG_FMT "\n", 97 - regs->t5, regs->t6); 96 + pr_cont(" t5 : " REG_FMT " t6 : " REG_FMT " ssp : " REG_FMT "\n", 97 + regs->t5, regs->t6, get_active_shstk(current)); 98 98 99 99 pr_cont("status: " REG_FMT " badaddr: " REG_FMT " cause: " REG_FMT "\n", 100 100 regs->status, regs->badaddr, regs->cause);