On Tue, Jul 07, 2026 at 09:06:15PM +0200, Thomas Gleixner wrote:
quoted hunk ↗ jump to hunk
syscall_enter_from_user_mode_randomize_stack() replaces
syscall_enter_from_user_mode() and the subsequent invocation of
add_random_kstack_offset().
The advantage is that it applies the stack randomization right after
enter_from_user_mode() and thereby avoids the overhead of get/put_cpu_var()
as that code is invoked with interrupts disabled.
No functional change.
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 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/arch/powerpc/kernel/syscall.c
+++ b/arch/powerpc/kernel/syscall.c
@@ -2,7 +2,6 @@
#include <linux/compat.h>
#include <linux/context_tracking.h>
-#include <linux/randomize_kstack.h>
#include <linux/entry-common.h>
#include <asm/interrupt.h>
@@ -19,8 +18,7 @@ notrace long system_call_exception(struc
long ret;
syscall_fn f;
- r0 = syscall_enter_from_user_mode(regs, r0);
- add_random_kstack_offset();
+ r0 = syscall_enter_from_user_mode_randomize_stack(regs, r0);
if (unlikely(r0 >= NR_syscalls)) {
if (unlikely(trap_is_unsupported_scv(regs))) {
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <redacted>