From nobody Sat Jul 25 23:06:36 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 E142A3ACEE0; Sun, 12 Jul 2026 12:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783860251; cv=none; b=kvgy3218snPhgMc6pHF6Teb0bH3Ol9Z0ENqSdlJ5LCy45BDVtT2m5GbQJBjXz2NvFg+9B4GF6OlPvf+oRJzl7oHEsHcWBk47UINoJAhiMay4U6enJE6zE5qxf9bTH79FBzglVMv1c58XS8fUM8FgzY5cHxr0bVf44rHVnugQQCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783860251; c=relaxed/simple; bh=5nCc4UeFVtbWRMBzKF2J6eaQlkFcdMruPN/D2AAgRJg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=XPrSIY5uG5V5M5psl/Ghj67dWnumgkARPPi3wYyxEFe4GiAtWJILKyVlrzq8x3NB0JjHzIQjkLaNuNng7pBaIjpEWYS1HEWjLLg7cotzB5grdXNSaA7kuM5ysbotNUIwEGxsANSRDg2xdUeg8nF8wj4fF4u3hgBHVcf/jKUvLZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bRFBTBfV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Fx61lpSW; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bRFBTBfV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Fx61lpSW" Date: Sun, 12 Jul 2026 12:44:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1783860245; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nogp9gcQvssvMZSgHq64IZt3kcWCFMGLgZ1Y4XnT86c=; b=bRFBTBfVQoR7TssXcP1LzaUUGfXyzplIzyJU+s0xig0Owyt8O2f8yI6LEz7NsnkjZhRkVd ztHPmmZHhS5RW4+f988Y+4NQSj14muggR9N5e3ThF9SUa9pmt5b72XYVrgWKBQAykEnXkX UlAkZGIhMX3GBKpl27lECY+QvvJ9M/Oe4R9T4S+qR4s9YoRfsuwOmSRPr+ZJfBqKXrl7Ip CS/Ed/ciEf8UBSa49ngiJZeEnF3gJadQFuZP7AV2TFy8ty121a7y7q12zLl/iuy5vKn+0U fjXsRpmkjBIStRzjNLXMx6c3nOhv6i3U6VDwV9/89jQ9gkRX1/KmboMimCmoUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1783860245; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nogp9gcQvssvMZSgHq64IZt3kcWCFMGLgZ1Y4XnT86c=; b=Fx61lpSWXOWsqhnNzgFyDXh7M5ceZDsR1yAMXi9QfGCEVpDCAXxweNuGmsj2/F1C1VnyeR /k133rtRBGbq9UDg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/entry] x86/syscall: Use [syscall_]enter_from_user_mode_randomize_stack() Cc: Thomas Gleixner , "Mukesh Kumar Chaurasiya (IBM)" , Radu Rendec , Jinjie Ruan , philmd@oss.qualcomm.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260707190254.079478122@kernel.org> References: <20260707190254.079478122@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178386024396.1844600.9360850619305308417.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the core/entry branch of tip: Commit-ID: 9d311796e2ce75b3aaded2719a01d7e248c3a24f Gitweb: https://git.kernel.org/tip/9d311796e2ce75b3aaded2719a01d7e24= 8c3a24f Author: Thomas Gleixner AuthorDate: Tue, 07 Jul 2026 21:06:27 +02:00 Committer: Thomas Gleixner CommitterDate: Sun, 12 Jul 2026 12:38:01 +02:00 x86/syscall: Use [syscall_]enter_from_user_mode_randomize_stack() These functions integrate the stack randomization. syscall_enter_from_user_mode_randomize_stack() has the advantage that the randomization happens early right after enter_from_user_mode(). In both cases also the overhead of get/put_cpu_var() in add_random_kstack_offset() is avoided. No functional change. Signed-off-by: Thomas Gleixner Tested-by: Mukesh Kumar Chaurasiya (IBM) Reviewed-by: Radu Rendec Reviewed-by: Jinjie Ruan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mukesh Kumar Chaurasiya (IBM) Link: https://patch.msgid.link/20260707190254.079478122@kernel.org --- arch/x86/entry/syscall_32.c | 19 +++++-------------- arch/x86/entry/syscall_64.c | 3 +-- arch/x86/include/asm/entry-common.h | 1 - 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c index 31b9492..2b13f1c 100644 --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -142,10 +142,9 @@ __visible noinstr void do_int80_emulation(struct pt_re= gs *regs) * int80_is_external() below which calls into the APIC driver. * Identical for soft and external interrupts. */ - enter_from_user_mode(regs); + enter_from_user_mode_randomize_stack(regs); =20 instrumentation_begin(); - add_random_kstack_offset(); =20 /* Validate that this is a soft interrupt to the extent possible */ if (unlikely(int80_is_external())) @@ -210,11 +209,9 @@ DEFINE_FREDENTRY_RAW(int80_emulation) { int nr; =20 - enter_from_user_mode(regs); + enter_from_user_mode_randomize_stack(regs); =20 instrumentation_begin(); - add_random_kstack_offset(); - /* * FRED pushed 0 into regs::orig_ax and regs::ax contains the * syscall number. @@ -252,10 +249,10 @@ __visible noinstr void do_int80_syscall_32(struct pt_= regs *regs) * orig_ax, the int return value truncates it. This matches * the semantics of syscall_get_nr(). */ - nr =3D syscall_enter_from_user_mode(regs, nr); + nr =3D syscall_enter_from_user_mode_randomize_stack(regs, nr); + instrumentation_begin(); =20 - add_random_kstack_offset(); do_syscall_32_irqs_on(regs, nr); =20 instrumentation_end(); @@ -268,15 +265,9 @@ static noinstr bool __do_fast_syscall_32(struct pt_reg= s *regs) int nr =3D syscall_32_enter(regs); int res; =20 - /* - * This cannot use syscall_enter_from_user_mode() as it has to - * fetch EBP before invoking any of the syscall entry work - * functions. - */ - enter_from_user_mode(regs); + enter_from_user_mode_randomize_stack(regs); =20 instrumentation_begin(); - add_random_kstack_offset(); local_irq_enable(); /* Fetch EBP from where the vDSO stashed it. */ if (IS_ENABLED(CONFIG_X86_64)) { diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index 71f0325..0acd7e9 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -86,10 +86,9 @@ static __always_inline bool do_syscall_x32(struct pt_reg= s *regs, int nr) /* Returns true to return using SYSRET, or false to use IRET */ __visible noinstr bool do_syscall_64(struct pt_regs *regs, int nr) { - nr =3D syscall_enter_from_user_mode(regs, nr); + nr =3D syscall_enter_from_user_mode_randomize_stack(regs, nr); =20 instrumentation_begin(); - add_random_kstack_offset(); =20 if (!do_syscall_x64(regs, nr) && !do_syscall_x32(regs, nr) && nr !=3D -1)= { /* Invalid system call, but still a system call. */ diff --git a/arch/x86/include/asm/entry-common.h b/arch/x86/include/asm/ent= ry-common.h index eca24b5..3fed46b 100644 --- a/arch/x86/include/asm/entry-common.h +++ b/arch/x86/include/asm/entry-common.h @@ -2,7 +2,6 @@ #ifndef _ASM_X86_ENTRY_COMMON_H #define _ASM_X86_ENTRY_COMMON_H =20 -#include #include =20 #include