]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv/ptrace: expose riscv CFI status and state via ptrace and in core files
authorDeepak Gupta <debug@rivosinc.com>
Mon, 26 Jan 2026 04:09:55 +0000 (21:09 -0700)
committerPaul Walmsley <pjw@kernel.org>
Thu, 29 Jan 2026 09:38:40 +0000 (02:38 -0700)
commit2af7c9cf021c5dabe880b68e5cc22c618060d954
treecd59214c391bc61fa047940612019fed2b1cfe21
parent9d0e75e25e3be74828ffb7657992ce0f03352cc3
riscv/ptrace: expose riscv CFI status and state via ptrace and in core files

Expose a new register type NT_RISCV_USER_CFI for risc-v CFI status and
state. Intentionally, both landing pad and shadow stack status and
state are rolled into the CFI state. Creating two different
NT_RISCV_USER_XXX would not be useful and would waste a note
type. Enabling, disabling and locking the CFI feature is not allowed
via ptrace set interface. However, setting 'elp' state or setting
shadow stack pointer are allowed via the ptrace set interface.  It is
expected that 'gdb' might need to fixup 'elp' state or 'shadow stack'
pointer.

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-19-b55691eacf4f@rivosinc.com
[pjw@kernel.org: updated to apply; cleaned patch description and comments; addressed checkpatch issues]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/include/uapi/asm/ptrace.h
arch/riscv/kernel/ptrace.c
include/uapi/linux/elf.h