[PATCH] riscv: ptrace: reject CFI regset access when extensions are absent
Paul Walmsley
pjw at kernel.org
Wed Oct 7 08:39:03 PDT 2026
On Thu, 20 Aug 2026, Chen Pei wrote:
> riscv_cfi_get() and riscv_cfi_set() do not check whether the Zicfilp
> or Zicfiss extensions are present. On systems without them,
> PTRACE_GETREGSET on REGSET_CFI still succeeds and returns a zeroed
> user_cfi_state, misleading debuggers into believing the register set
> is available, and PTRACE_SETREGSET silently accepts writes that have
> no effect (e.g. clearing SR_ELP).
>
> Reject the access with -EINVAL when neither branch landing pads nor
> shadow stack is available to userspace, using the same availability
> helpers as the prctl path.
>
> Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files")
> Signed-off-by: Chen Pei <cp0613 at linux.alibaba.com>
Thanks, queued for v7.3-rc.
- Paul
More information about the linux-riscv
mailing list