From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E00C9C43602 for ; Tue, 7 Jul 2026 19:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=Ko42Ry29jFPoMyPQLdlxYhg8S/68hEmUYQPkE8hHtRo=; b=IbiRdSyPNDkWi6 tL7vL/xns3ZEI9NPyfaVdi0Jb3UumavoFXcjSmuWyshwyAIvPYFNoUiWNIik577isb3LLWUfxJdMy xwMDfnygr7RK3UdxWzD2hIQQDL+L4yPI7ymb+6P000Tfj7JEvaK8AAeknleIsEWtHncJNWU395te+ iygU9ByOCfh6kTxLJ6W7C9adBI7+SNAGIJULuVIJeCIYJBhzv9gyLn9m5VT4Ux+yHqHsGK08KEz3T WLFIOI+Dji1oAcP/UXtaxh1zYRSjzXut7vbqmIRxYIaYeg3ZDi9UsbS+6Dxn9Z+B91EEr0NNo4YbL ttP/3KCGhA6GdS4KpsXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whB8B-0000000FhYD-2mRN; Tue, 07 Jul 2026 19:06:55 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1whB7r-0000000Fh9X-2CCH; Tue, 07 Jul 2026 19:06:36 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id E30E0601EC; Tue, 7 Jul 2026 19:06:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C91BA1F000E9; Tue, 7 Jul 2026 19:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783451194; bh=Ko42Ry29jFPoMyPQLdlxYhg8S/68hEmUYQPkE8hHtRo=; h=Date:From:To:Cc:Subject:References; b=d68e/zkh5oU9ziZmyD8/j0zm+dms5mzI3QpxXDgS3beo+n+Xnv/2HSq+wH632V3sd 8uTzG42LNfaK05lc2KYYdDujQ1J4Cgu9HUzFOHwcGxBUM8uoXWnE/1r5BSASo70M2/ BeZM/CiOfzvrrk1xZNqIUAM6oN02Mkik+/OqqvpTFPpbyHqBCzcd+u7xOyvYG2DB/V bFMusVe8fZm0EviIlm2Cdc6bEcEu9PSgqO6pG/h8ekgyn42NUtvGGWIO67Mdyq29CY XsTesNZZfW6pwplIhbQXruHpmuALvlix8sPBSkJLCO72NF5LTVJjzfgWsBEq/Yvuwu cgcjZWz5+d1VQ== Date: Tue, 07 Jul 2026 21:06:32 +0200 Message-ID: <20260707190254.132654198@kernel.org> User-Agent: quilt/0.69 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Michael Ellerman , Shrikanth Hegde , linuxppc-dev@lists.ozlabs.org, Kees Cook , Huacai Chen , loongarch@lists.linux.dev, 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 09/18] entry: Remove syscall_enter_from_user_mode() References: <20260707181957.433213175@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org All architecture use either: nr = enter_from_user_mode_randomize_stack(regs, nr); or enter_from_user_mode_randomize_stack(regs); nr = syscall_enter_from_user_mode_work(regs, nr); Remove the now unused function. Signed-off-by: Thomas Gleixner --- Documentation/core-api/entry.rst | 17 +++++++++------- include/linux/entry-common.h | 40 +++------------------------------------ include/linux/irq-entry-common.h | 6 ++--- 3 files changed, 17 insertions(+), 46 deletions(-) --- a/Documentation/core-api/entry.rst +++ b/Documentation/core-api/entry.rst @@ -68,7 +68,7 @@ low-level C code must not be instrumente noinstr void syscall(struct pt_regs *regs, int nr) { arch_syscall_enter(regs); - nr = syscall_enter_from_user_mode(regs, nr); + nr = syscall_enter_from_user_mode_randomize_stack(regs, nr); instrumentation_begin(); if (!invoke_syscall(regs, nr) && nr != -1) @@ -78,12 +78,14 @@ low-level C code must not be instrumente syscall_exit_to_user_mode(regs); } -syscall_enter_from_user_mode() first invokes enter_from_user_mode() which -establishes state in the following order: +syscall_enter_from_user_mode_randomize_stack() first invokes +enter_from_user_mode_randomize_stack() which establishes state in the +following order: * Lockdep * RCU / Context tracking * Tracing + * Apply stack randomization and then invokes the various entry work functions like ptrace, seccomp, audit, syscall tracing, etc. After all that is done, the instrumentable invoke_syscall @@ -99,10 +101,11 @@ that it invokes exit_to_user_mode() whic * RCU / Context tracking * Lockdep -syscall_enter_from_user_mode() and syscall_exit_to_user_mode() are also -available as fine grained subfunctions in cases where the architecture code -has to do extra work between the various steps. In such cases it has to -ensure that enter_from_user_mode() is called first on entry and +syscall_enter_from_user_mode_randomize_stack() and +syscall_exit_to_user_mode() are also available as fine grained subfunctions +in cases where the architecture code has to do extra work between the +various steps. In such cases it has to ensure that +enter_from_user_mode_randomize_stack() is called first on entry and exit_to_user_mode() is called last on exit. Do not nest syscalls. Nested syscalls will cause RCU and/or context tracking --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -19,7 +19,7 @@ #endif /* - * SYSCALL_WORK flags handled in syscall_enter_from_user_mode() + * SYSCALL_WORK flags handled in syscall_enter_from_user_mode_work() */ #define SYSCALL_WORK_ENTER (SYSCALL_WORK_SECCOMP | \ SYSCALL_WORK_SYSCALL_TRACEPOINT | \ @@ -205,42 +205,10 @@ do { \ _ret; \ }) -/** - * syscall_enter_from_user_mode - Establish state and check and handle work - * before invoking a syscall - * @regs: Pointer to currents pt_regs - * @syscall: The syscall number - * - * Invoked from architecture specific syscall entry code with interrupts - * disabled. The calling code has to be non-instrumentable. When the - * function returns all state is correct, interrupts are enabled and the - * subsequent functions can be instrumented. - * - * This is the combination of enter_from_user_mode() and - * syscall_enter_from_user_mode_work() to be used when there is no - * architecture specific work to be done between the two. - * - * Returns: The original or a modified syscall number. See - * syscall_enter_from_user_mode_work() for further explanation. - */ -static __always_inline long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall) -{ - long ret; - - enter_from_user_mode(regs); - - instrumentation_begin(); - local_irq_enable(); - ret = syscall_enter_from_user_mode_work(regs, syscall); - instrumentation_end(); - - return ret; -} - /* - * If SYSCALL_EMU is set, then the only reason to report is when - * SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall - * instruction has been already reported in syscall_enter_from_user_mode(). + * If SYSCALL_EMU is set, then the only reason to report is when SINGLESTEP is + * set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall instruction has been + * already reported in syscall_enter_from_user_mode_work(). */ static __always_inline bool report_single_step(unsigned long work) { --- a/include/linux/irq-entry-common.h +++ b/include/linux/irq-entry-common.h @@ -49,9 +49,9 @@ * Defaults to an empty implementation. Can be replaced by architecture * specific code. * - * Invoked from syscall_enter_from_user_mode() in the non-instrumentable - * section. Use __always_inline so the compiler cannot push it out of line - * and make it instrumentable. + * Invoked from enter_from_user_mode_syscall_and_randomize_stack() in the + * non-instrumentable section. Use __always_inline so the compiler cannot push + * it out of line and make it instrumentable. */ static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs);