Thread (98 messages) 98 messages, 14 authors, 2d ago

Re: [patch 01/18] powerpc: Move stack randomization after syscall_enter_from_user_mode()

From: Philippe Mathieu-Daudé <hidden>
Date: 2026-07-09 11:13:04
Also in: linux-alpha, linux-arch, linux-doc, linux-m68k, linux-mips, linux-riscv, linux-s390, linux-sh, linux-um, lkml, loongarch, sparclinux

On 7/7/26 21:05, Thomas Gleixner wrote:
quoted hunk ↗ jump to hunk
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.

Move it after syscall_enter_from_user_mode() to ensure that state is
correctly established.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Shrikanth Hegde <redacted>
Cc: linuxppc-dev@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: Philippe Mathieu-Daudé <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help