Re: [patch 06/18] riscv/syscall: Use syscall_enter_from_user_mode_randomize_stack()
Radu Rendec <[email protected]> Wed, 08 Jul 2026 16:57:00 -0400
| Newsgroups | gmane.linux.ports.m68k,gmane.linux.kernel,gmane.linux.ports.riscv,gmane.linux.ports.ppc64.devel,gmane.linux.ports.arm.kernel,gmane.linux.ports.alpha,gmane.linux.ports.mips,gmane.linux.ports.parisc,gmane.linux.ports.sh.devel,gmane.linux.uml.devel,gmane.linux.kernel.arc,gmane.linux.ports.hexagon,gmane.linux.ports.sparc,gmane.linux.kernel.cross-arch,gmane.linux.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2026-07-07 at 21:06 +0200, Thomas Gleixner wrote: > syscall_enter_from_user_mode_randomize_stack() replaces > syscall_enter_from_user_mode() and the subsequent invocation of > add_random_kstack_offset(). >=20 > 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. >=20 > No functional change. >=20 > Signed-off-by: Thomas Gleixner <[email protected]> > Cc: Paul Walmsley <[email protected]> > Cc: Palmer Dabbelt <[email protected]> > Cc: [email protected] > --- > =C2=A0arch/riscv/kernel/traps.c |=C2=A0=C2=A0=C2=A0 5 +---- > =C2=A01 file changed, 1 insertion(+), 4 deletions(-) >=20 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -7,7 +7,6 @@ > =C2=A0#include <linux/kernel.h> > =C2=A0#include <linux/init.h> > =C2=A0#include <linux/irqflags.h> > -#include <linux/randomize_kstack.h> > =C2=A0#include <linux/sched.h> > =C2=A0#include <linux/sched/debug.h> > =C2=A0#include <linux/sched/signal.h> > @@ -333,9 +332,7 @@ void do_trap_ecall_u(struct pt_regs *reg > =C2=A0 > =C2=A0 riscv_v_vstate_discard(regs); > =C2=A0 > - syscall =3D syscall_enter_from_user_mode(regs, syscall); > - > - add_random_kstack_offset(); > + syscall =3D syscall_enter_from_user_mode_randomize_stack(regs, syscall= ); > =C2=A0 > =C2=A0 if (syscall >=3D 0 && syscall < NR_syscalls) { > =C2=A0 syscall =3D array_index_nospec(syscall, NR_syscalls); Reviewed-by: Radu Rendec <[email protected]>