Re: [patch 04/18] loongarch/syscall: Use syscall_enter_from_user_mode_randomize_stack()
Radu Rendec <[email protected]> Wed, 08 Jul 2026 14:37:13 -0400
| Newsgroups | org.kernel.vger.linux-hexagon,dev.linux.lists.loongarch,org.infradead.lists.linux-riscv,org.infradead.lists.linux-snps-arc,org.infradead.lists.linux-um,org.kernel.vger.linux-alpha,org.kernel.vger.linux-arch,org.kernel.vger.linux-csky,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-m68k,org.kernel.vger.linux-mips,org.kernel.vger.linux-openrisc,org.kernel.vger.linux-parisc,org.kernel.vger.linux-s390,org.kernel.vger.linux-sh,org.kernel.vger.sparclinux,org.ozlabs.lists.linuxppc-dev |
|---|---|
| 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: Huacai Chen <[email protected]> > Cc: [email protected] > --- > =C2=A0arch/loongarch/kernel/syscall.c |=C2=A0=C2=A0=C2=A0 5 +---- > =C2=A01 file changed, 1 insertion(+), 4 deletions(-) >=20 > --- a/arch/loongarch/kernel/syscall.c > +++ b/arch/loongarch/kernel/syscall.c > @@ -11,7 +11,6 @@ > =C2=A0#include <linux/linkage.h> > =C2=A0#include <linux/nospec.h> > =C2=A0#include <linux/objtool.h> > -#include <linux/randomize_kstack.h> > =C2=A0#include <linux/syscalls.h> > =C2=A0#include <linux/unistd.h> > =C2=A0 > @@ -70,9 +69,7 @@ void noinstr __no_stack_protector do_sys > =C2=A0 regs->orig_a0 =3D regs->regs[4]; > =C2=A0 regs->regs[4] =3D -ENOSYS; > =C2=A0 > - nr =3D syscall_enter_from_user_mode(regs, nr); > - > - add_random_kstack_offset(); > + nr =3D syscall_enter_from_user_mode_randomize_stack(regs, nr); > =C2=A0 > =C2=A0 if (nr < NR_syscalls) { > =C2=A0 syscall_fn =3D sys_call_table[array_index_nospec(nr, NR_syscalls)= ]; Reviewed-by: Radu Rendec <[email protected]>