]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv/mm: teach pte_mkwrite to manufacture shadow stack PTEs
authorDeepak Gupta <debug@rivosinc.com>
Mon, 26 Jan 2026 04:09:53 +0000 (21:09 -0700)
committerPaul Walmsley <pjw@kernel.org>
Mon, 26 Jan 2026 04:09:53 +0000 (21:09 -0700)
commitc68c2ef9d64169317a6e0e6f0506953637760409
tree0ad31ea1d9f024a19290176a97ba8eea3c6bb589
parentf56ffb8ada46aae61580905d93c31e4006572240
riscv/mm: teach pte_mkwrite to manufacture shadow stack PTEs

pte_mkwrite() creates PTEs with WRITE encodings for the underlying
architecture.  The underlying architecture can have two types of
writeable mappings: one that can be written using regular store
instructions, and another one that can only be written using
specialized store instructions (like shadow stack stores).
pte_mkwrite can select write PTE encoding based on VMA range (i.e.
VM_SHADOW_STACK)

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Deepak Gupta <debug@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-8-b55691eacf4f@rivosinc.com
[pjw@kernel.org: cleaned up patch description]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/include/asm/pgtable.h
arch/riscv/mm/pgtable.c