Re: [PATCH v2] riscv: mm: Implement arch_within_stack_frames() for HARDENED_USERCOPY

From: Vivian Wang

Date: Thu Apr 16 2026 - 22:16:53 EST


Hi Chen Pei,

Thanks for the patch.

On 4/14/26 18:01, cp0613@xxxxxxxxxxxxxxxxx wrote:
> From: Chen Pei <cp0613@xxxxxxxxxxxxxxxxx>
>
> Implement arch_within_stack_frames() to enable precise per-frame stack
> object validation for CONFIG_HARDENED_USERCOPY on RISC-V.

[...]

> diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
> index 36918c9200c9..5899877c2a49 100644
> --- a/arch/riscv/include/asm/thread_info.h
> +++ b/arch/riscv/include/asm/thread_info.h
> @@ -101,6 +101,74 @@ struct thread_info {
> void arch_release_task_struct(struct task_struct *tsk);
> int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
>
> +/*
> + * RISC-V stack frame layout (with frame pointer enabled).
> + *
> + * Reference: RISC-V ELF psABI, Frame Pointer Convention
> + * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/
> + * riscv-cc.adoc#frame-pointer-convention
> + *

I don't know what the maintainers would prefer, but I would personally
prefer to break the line "limit" here and put the URL in one line, so
that it's clickable in editors.

Otherwise:

Reviewed-by: Vivian Wang <wangruikang@xxxxxxxxxxx>

Thanks,
Vivian "dramforever" Wang