From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400473F54D8 for ; Tue, 7 Jul 2026 19:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=172.105.4.254 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783451179; cv=none; b=RmYwIgHqb0ipK04VwgfLiH8OLAvTXZiPfilSJYsEX5FmwbHgS9OMdoZuwlmSJ0vvC2X7LhRq/t5wKsigjsL0lKasgRWVUNWmTh9+kcfbr1mHahgep9Svw9U7pikp1smTfEX0UaH9cI5jOg7BczydXNDFSALtgH/aCCZeOHvp4nU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783451179; c=relaxed/simple; bh=/ShrazNoDRJYcoJPipwaW5cSycazwuXUK/Lpp8y6PZw=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=t9VWv+efs0FEhSww6+cPBW0Ysi126YbxbqV1FGHtcwYZgi2AupLWqkbvFsdCFJMpD5KKAS+LRu7J56KUcfiCACgmJKvcH/AyZ7CLO3puKBY5mv92DQd1jbYcu9HdhwYK9dEOq0twkWTaWtqeeFh+goA7UwMTU3lxnq7cy9BaPoU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L0NwhOtn; arc=none smtp.client-ip=172.105.4.254 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L0NwhOtn" Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 007A061389; Tue, 7 Jul 2026 19:06:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB3571F000E9; Tue, 7 Jul 2026 19:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783451173; bh=4+5KtSAhpclzOPxgH9736FL7Uf1pNCSlMPQrqwffdRU=; h=Date:From:To:Cc:Subject:References; b=L0NwhOtn/pOWM0ulqppTdz+f5F1vPIiktRF8++iqaXbfQrbA09EWRmKXUTgs+tJGZ 9BOc+sE0QdxWAWxboebj5k3TGGiEZy86TkscBomKuqCnVcID0FRgb+hXm7kRhQb508 18f9wNTMGjmah3berrpcvUtgyoh65Oruioe9rXjT2vjCE0ifLG+hzmK2ha75qKIz8p 1GtYXAThFYccYlfm3dA4KtHGVG1cGenYQHaPXFR1tPeFk2o5v6tnBtmGInkBCyatdE GHsMMbjrc9U1K+LMYACpZgx7BpGh3yI1J/j1USPF0e6lRALp6AqGe77XqRzuOFecve UXBMPM/ZYnxHQ== Date: Tue, 07 Jul 2026 21:06:11 +0200 Message-ID: <20260707190253.865955911@kernel.org> User-Agent: quilt/0.69 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Huacai Chen , loongarch@lists.linux.dev, Michael Ellerman , Shrikanth Hegde , linuxppc-dev@lists.ozlabs.org, Kees Cook , Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Sven Schnelle , linux-s390@vger.kernel.org, x86@kernel.org, Mark Rutland , Jinjie Ruan , Andy Lutomirski , Oleg Nesterov , Richard Henderson , Russell King , Catalin Marinas , Guo Ren , Geert Uytterhoeven , Thomas Bogendoerfer , Helge Deller , Yoshinori Sato , Richard Weinberger , Chris Zankel , linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org, linux-csky@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Arnd Bergmann , Vineet Gupta , Will Deacon , Brian Cain , Michal Simek , Dinh Nguyen , "David S. Miller" , Andreas Larsson , linux-snps-arc@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-openrisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, =?UTF-8?q?Michal=20Such=C3=A1nek?= , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [patch 04/18] loongarch/syscall: Use syscall_enter_from_user_mode_randomize_stack() References: <20260707181957.433213175@kernel.org> Precedence: bulk X-Mailing-List: linux-m68k@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Cc: Huacai Chen Cc: loongarch@lists.linux.dev --- arch/loongarch/kernel/syscall.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/arch/loongarch/kernel/syscall.c +++ b/arch/loongarch/kernel/syscall.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -70,9 +69,7 @@ void noinstr __no_stack_protector do_sys regs->orig_a0 = regs->regs[4]; regs->regs[4] = -ENOSYS; - nr = syscall_enter_from_user_mode(regs, nr); - - add_random_kstack_offset(); + nr = syscall_enter_from_user_mode_randomize_stack(regs, nr); if (nr < NR_syscalls) { syscall_fn = sys_call_table[array_index_nospec(nr, NR_syscalls)];