[PATCH v22 10/28] riscv/mm: Implement map_shadow_stack() syscall

Paul Walmsley pjw at kernel.org
Fri Oct 31 12:48:10 PDT 2025


On Thu, 23 Oct 2025, Deepak Gupta via B4 Relay wrote:

> From: Deepak Gupta <debug at rivosinc.com>
> 
> As discussed extensively in the changelog for the addition of this
> syscall on x86 ("x86/shstk: Introduce map_shadow_stack syscall") the
> existing mmap() and madvise() syscalls do not map entirely well onto the
> security requirements for shadow stack memory since they lead to windows
> where memory is allocated but not yet protected or stacks which are not
> properly and safely initialised. Instead a new syscall map_shadow_stack()
> has been defined which allocates and initialises a shadow stack page.
> 
> This patch implements this syscall for riscv. riscv doesn't require token
> to be setup by kernel because user mode can do that by itself. However to
> provide compatibility and portability with other architectues, user mode
> can specify token set flag.
> 
> Reviewed-by: Zong Li <zong.li at sifive.com>
> Signed-off-by: Deepak Gupta <debug at rivosinc.com>

This patch introduces a 'checkpatch.pl --strict' message:

CHECK: Lines should not end with a '('
#78: FILE: arch/riscv/kernel/usercfi.c:36:
+	asm goto(

I'll fix it up here in the event that v22 goes in, but please do the same 
on your side in case a new version is needed.


thanks,

- Paul



More information about the linux-riscv mailing list