[patch 01/18] powerpc: Move stack randomization after syscall_enter_from_user_mode()
Shrikanth Hegde
sshegde at linux.ibm.com
Wed Jul 8 07:07:51 PDT 2026
On 7/8/26 12:35 AM, Thomas Gleixner wrote:
> add_random_kstack_offset() is invoked before syscall_enter_from_user_mode()
> establishes state. That's wrong because add_random_kstack_offset() calls
> into instrumentable code.
Thanks for fixing that.
>
> Move it after syscall_enter_from_user_mode() to ensure that state is
> correctly established.
>
> Signed-off-by: Thomas Gleixner <tglx at kernel.org>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Shrikanth Hegde <sshegde at linux.ibm.com>
> Cc: linuxppc-dev at lists.ozlabs.org
> ---
> arch/powerpc/kernel/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/powerpc/kernel/syscall.c
> +++ b/arch/powerpc/kernel/syscall.c
> @@ -19,8 +19,8 @@ notrace long system_call_exception(struc
> long ret;
> syscall_fn f;
>
> - add_random_kstack_offset();
> r0 = syscall_enter_from_user_mode(regs, r0);
> + add_random_kstack_offset();
>
> if (unlikely(r0 >= NR_syscalls)) {
> if (unlikely(trap_is_unsupported_scv(regs))) {
>
Reviewed-by: Shrikanth Hegde <sshegde at linux.ibm.com>
More information about the linux-riscv
mailing list