From nobody Sat Jul 25 23:05:54 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 66CC03A48C8; Sun, 12 Jul 2026 12:44:03 +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=1783860244; cv=none; b=GjFtO/MW2IjPlMLEia9uDol090rGB4wOhOG4BNJaM9DmtpeACXn/eN/itgDw65DIrMYmPnwJQgJQhTP1mhNzhf5nN6A1Ib1diHTU9kQVVYMZp7+WV/45rSDu0vGlKRQcGcE4idsxsCtD82fCSk/5SNjVe05z92J5RWn9Kb3AaJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783860244; c=relaxed/simple; bh=C0IaGwMtDDn6Y6CZtAN/qEEYtTzwzH6mFnamtf7bXJ8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=oaE41YRKGyWq71U99X2i8yP80u1tAC8os3YzsCCfuKh+HGK3cZW0PHWKoZvx9WrHPoIFIdKj3vXAdh/w5AtY0srifZZTxhEUvaFRNnYQHdkU8DDb6PY/LMcEb2I3X6LWaWc1S0kdKgkrnlPc8Hy+V3k9mXa3DG2QeifWJh9W6Oc= 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=M8H5HTmn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ONMyEJlP; 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="M8H5HTmn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ONMyEJlP" Date: Sun, 12 Jul 2026 12:43:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1783860236; 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=eyeLwU16cFPHuGh0iuqE+MRZG8tEPYbEafU/3KvfYHk=; b=M8H5HTmneuJdEl1gXVANbtXen51jbPTWjeZ1Dv4rpmARVB8uvH1053HOn+GZgGrxGDZtRi oh8Vi2gxU7CPJWloTdT30UuDq2QM6hRsOkytLut+lfuLv5eNLemlOutr3fH0CO8Qm3rNez fQezdU9w+3DO8hsiu9Xy9xVVqsSIFeMKmBWHDlVkE+W5GaruTBKWaiYAjFxM+VtTeSmuwH L2S17IWB0wfTUjo70oV31sH/T4z+2KojBYoZyRxz9SBUMXdgyBfKwUKE7EVivPQ+uHt/ne m82v0T4VHpR02iVvxV0MXQu6jh/SHjdhS7I6TURmQkJ1ILeYAjE+yqub2KFQUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1783860236; 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=eyeLwU16cFPHuGh0iuqE+MRZG8tEPYbEafU/3KvfYHk=; b=ONMyEJlP2+NHqNBSnnM9l0epA/+5DLysSIW0wvf479RTTQIMvS7LQRuJd2YALC5P8AkBTO bVcz52gCYMBr+QCw== 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/entry: Get rid of the sys_ni_syscall() indirection Cc: Thomas Gleixner , "Mukesh Kumar Chaurasiya (IBM)" , Jinjie Ruan , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260707190254.493733289@kernel.org> References: <20260707190254.493733289@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178386023485.1844600.8433733066512077207.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: 1b1f3b3e1b3945ae6e49081fd3586a6833d4a555 Gitweb: https://git.kernel.org/tip/1b1f3b3e1b3945ae6e49081fd3586a683= 3d4a555 Author: Thomas Gleixner AuthorDate: Tue, 07 Jul 2026 21:07:01 +02:00 Committer: Thomas Gleixner CommitterDate: Sun, 12 Jul 2026 12:38:02 +02:00 x86/entry: Get rid of the sys_ni_syscall() indirection Invoking sys_ni_syscall() from a code path, which already knows that the syscall number is invalid just to assign -ENOSYS to regs->ax is a pointless exercise. It's even redundant as the low level entry code already has set regs->ax to -ENOSYS on entry. Remove the extra conditionals and the function calls. Signed-off-by: Thomas Gleixner Tested-by: Mukesh Kumar Chaurasiya (IBM) Reviewed-by: Jinjie Ruan Link: https://patch.msgid.link/20260707190254.493733289@kernel.org --- arch/x86/entry/syscall_32.c | 2 -- arch/x86/entry/syscall_64.c | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c index 6e00929..68e2f13 100644 --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -81,8 +81,6 @@ static __always_inline void do_syscall_32_irqs_on(struct = pt_regs *regs, int nr) if (likely(unr < IA32_NR_syscalls)) { unr =3D array_index_nospec(unr, IA32_NR_syscalls); regs->ax =3D ia32_sys_call(regs, unr); - } else if (nr !=3D -1) { - regs->ax =3D __ia32_sys_ni_syscall(regs); } } =20 diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index 837aee7..c716e0f 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -68,7 +68,7 @@ static __always_inline bool do_syscall_x64(struct pt_regs= *regs, int nr) return false; } =20 -static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr) +static __always_inline void do_syscall_x32(struct pt_regs *regs, int nr) { /* * Adjust the starting offset of the table, and convert numbers @@ -80,9 +80,7 @@ static __always_inline bool do_syscall_x32(struct pt_regs= *regs, int nr) if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { xnr =3D array_index_nospec(xnr, X32_NR_syscalls); regs->ax =3D x32_sys_call(regs, xnr); - return true; } - return false; } =20 /* Returns true to return using SYSRET, or false to use IRET */ @@ -92,10 +90,8 @@ __visible noinstr bool do_syscall_64(struct pt_regs *reg= s, int nr) =20 instrumentation_begin(); =20 - if (!do_syscall_x64(regs, nr) && !do_syscall_x32(regs, nr) && nr !=3D -1)= { - /* Invalid system call, but still a system call. */ - regs->ax =3D __x64_sys_ni_syscall(regs); - } + if (!do_syscall_x64(regs, nr)) + do_syscall_x32(regs, nr); =20 instrumentation_end(); syscall_exit_to_user_mode(regs);