mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for H. Peter Anvin" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "H. Peter Anvin (Intel)" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/entry] x86/entry/vdso32: When using int $0x80, use it directly
Date: Wed, 14 Jan 2026 00:44:45 -0000	[thread overview]
Message-ID: <176835148500.510.1892669351642514353.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20251216212606.1325678-11-hpa@zytor.com>

The following commit has been merged into the x86/entry branch of tip:

Commit-ID:     36d83c249e0395a915144eceeb528ddc19b1fbe6
Gitweb:        https://git.kernel.org/tip/36d83c249e0395a915144eceeb528ddc19b1fbe6
Author:        H. Peter Anvin <hpa@zytor.com>
AuthorDate:    Tue, 16 Dec 2025 13:26:04 -08:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 13 Jan 2026 16:37:58 -08:00

x86/entry/vdso32: When using int $0x80, use it directly

When neither sysenter32 nor syscall32 is available (on either
FRED-capable 64-bit hardware or old 32-bit hardware), there is no
reason to do a bunch of stack shuffling in __kernel_vsyscall.
Unfortunately, just overwriting the initial "push" instructions will
mess up the CFI annotations, so suffer the 3-byte NOP if not
applicable.

Similarly, inline the int $0x80 when doing inline system calls in the
vdso instead of calling __kernel_vsyscall.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://patch.msgid.link/20251216212606.1325678-11-hpa@zytor.com
---
 arch/x86/entry/vdso/vdso32/system_call.S | 18 ++++++++++++++----
 arch/x86/include/asm/vdso/sys_call.h     |  4 +++-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso32/system_call.S b/arch/x86/entry/vdso/vdso32/system_call.S
index 7b1c0f1..9157cf9 100644
--- a/arch/x86/entry/vdso/vdso32/system_call.S
+++ b/arch/x86/entry/vdso/vdso32/system_call.S
@@ -14,6 +14,18 @@
 	ALIGN
 __kernel_vsyscall:
 	CFI_STARTPROC
+
+	/*
+	 * If using int $0x80, there is no reason to muck about with the
+	 * stack here. Unfortunately just overwriting the push instructions
+	 * would mess up the CFI annotations, but it is only a 3-byte
+	 * NOP in that case. This could be avoided by patching the
+	 * vdso symbol table (not the code) and entry point, but that
+	 * would a fair bit of tooling work or by simply compiling
+	 * two different vDSO images, but that doesn't seem worth it.
+	 */
+	ALTERNATIVE "int $0x80; ret", "", X86_FEATURE_SYSFAST32
+
 	/*
 	 * Reshuffle regs so that all of any of the entry instructions
 	 * will preserve enough state.
@@ -52,11 +64,9 @@ __kernel_vsyscall:
 	#define SYSENTER_SEQUENCE	"movl %esp, %ebp; sysenter"
 	#define SYSCALL_SEQUENCE	"movl %ecx, %ebp; syscall"
 
-	/* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */
-	ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSFAST32, \
-			  SYSCALL_SEQUENCE,  X86_FEATURE_SYSCALL32
+	ALTERNATIVE SYSENTER_SEQUENCE, SYSCALL_SEQUENCE, X86_FEATURE_SYSCALL32
 
-	/* Enter using int $0x80 */
+	/* Re-enter using int $0x80 */
 	int	$0x80
 SYM_INNER_LABEL(int80_landing_pad, SYM_L_GLOBAL)
 
diff --git a/arch/x86/include/asm/vdso/sys_call.h b/arch/x86/include/asm/vdso/sys_call.h
index dcfd17c..5806b1c 100644
--- a/arch/x86/include/asm/vdso/sys_call.h
+++ b/arch/x86/include/asm/vdso/sys_call.h
@@ -20,7 +20,9 @@
 # define __sys_reg4	"r10"
 # define __sys_reg5	"r8"
 #else
-# define __sys_instr	"call __kernel_vsyscall"
+# define __sys_instr	ALTERNATIVE("ds;ds;ds;int $0x80",		\
+				    "call __kernel_vsyscall",		\
+				    X86_FEATURE_SYSFAST32)
 # define __sys_clobber	"memory"
 # define __sys_nr(x,y)	__NR_ ## x ## y
 # define __sys_reg1	"ebx"

  reply	other threads:[~2026-01-14  0:44 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 21:25 [PATCH v4 00/10] x86/entry/vdso: clean up the vdso build, vdso updates H. Peter Anvin
2025-12-16 21:25 ` [PATCH v4 01/10] x86/entry/vdso: rename vdso_image_* to vdso*_image H. Peter Anvin
2026-01-14  0:01   ` [tip: x86/entry] x86/entry/vdso: Rename " tip-bot2 for H. Peter Anvin
2025-12-16 21:25 ` [PATCH v4 02/10] x86/entry/vdso: move vdso2c to arch/x86/tools H. Peter Anvin
2026-01-14  0:01   ` [tip: x86/entry] x86/entry/vdso: Move " tip-bot2 for H. Peter Anvin
2026-01-27 22:16     ` [PATCH] x86/entry/vdso: Add vdso2c to .gitignore Borislav Petkov
2026-01-27 22:33       ` [tip: x86/entry] " tip-bot2 for Borislav Petkov (AMD)
2025-12-16 21:25 ` [PATCH v4 03/10] x86/entry/vdso: refactor the vdso build H. Peter Anvin
2026-01-14  0:01   ` [tip: x86/entry] x86/entry/vdso: Refactor " tip-bot2 for H. Peter Anvin
2025-12-16 21:25 ` [PATCH v4 04/10] x86/entry/vdso32: don't rely on int80_landing_pad for adjusting ip H. Peter Anvin
2026-01-14  0:44   ` [tip: x86/entry] x86/entry/vdso32: Don't " tip-bot2 for H. Peter Anvin
2025-12-16 21:25 ` [PATCH v4 05/10] x86/entry/vdso32: remove SYSCALL_ENTER_KERNEL macro in sigreturn.S H. Peter Anvin
2026-01-14  0:44   ` [tip: x86/entry] x86/entry/vdso32: Remove " tip-bot2 for H. Peter Anvin
2025-12-16 21:26 ` [PATCH v4 06/10] x86/entry/vdso32: remove open-coded DWARF " H. Peter Anvin
2026-01-14  0:44   ` [tip: x86/entry] x86/entry/vdso32: Remove " tip-bot2 for H. Peter Anvin
2025-12-16 21:26 ` [PATCH v4 07/10] x86/entry/vdso: include GNU_PROPERTY and GNU_STACK PHDRs H. Peter Anvin
2025-12-18  2:16   ` Brian Gerst
2025-12-18  6:56     ` Brian Gerst
2026-01-14  0:44   ` [tip: x86/entry] x86/entry/vdso: Include " tip-bot2 for H. Peter Anvin
2025-12-16 21:26 ` [PATCH v4 08/10] x86/vdso: abstract out vdso system call internals H. Peter Anvin
2026-01-06 18:09   ` Uros Bizjak
2026-01-14  0:44   ` [tip: x86/entry] x86/vdso: Abstract " tip-bot2 for H. Peter Anvin
2025-12-16 21:26 ` [PATCH v4 09/10] x86/cpufeature: replace X86_FEATURE_SYSENTER32 with X86_FEATURE_SYSFAST32 H. Peter Anvin
2026-01-14  0:44   ` [tip: x86/entry] x86/cpufeature: Replace " tip-bot2 for H. Peter Anvin
2025-12-16 21:26 ` [PATCH v4 10/10] x86/entry/vdso32: when using int $0x80, use it directly H. Peter Anvin
2026-01-14  0:44   ` tip-bot2 for H. Peter Anvin [this message]
2026-01-06 21:18 ` [PATCH v4.1 00/10] x86/entry/vdso: clean up the vdso build, vdso updates H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 01/10] x86/entry/vdso: rename vdso_image_* to vdso*_image H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 02/10] x86/entry/vdso: move vdso2c to arch/x86/tools H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 03/10] x86/entry/vdso: refactor the vdso build H. Peter Anvin
2026-01-16  3:58     ` Chris Mason
2026-01-06 21:18   ` [PATCH v4.1 04/10] x86/entry/vdso32: don't rely on int80_landing_pad for adjusting ip H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 05/10] x86/entry/vdso32: remove SYSCALL_ENTER_KERNEL macro in sigreturn.S H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 06/10] x86/entry/vdso32: remove open-coded DWARF " H. Peter Anvin
2026-02-02 17:02     ` Jens Remus
2026-02-03  3:57       ` H. Peter Anvin
2026-02-10  3:11         ` Xi Ruoyao
2026-02-10  4:15           ` H. Peter Anvin
2026-02-10  4:45             ` Xi Ruoyao
2026-02-10  4:53               ` H. Peter Anvin
2026-02-10  4:51           ` H. Peter Anvin
2026-02-10  4:56             ` Xi Ruoyao
2026-02-10  5:24               ` H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 07/10] x86/entry/vdso: include GNU_PROPERTY and GNU_STACK PHDRs H. Peter Anvin
2026-01-07 12:10     ` Andrew Cooper
2026-01-06 21:18   ` [PATCH v4.1 08/10] x86/vdso: abstract out vdso system call internals H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 09/10] x86/cpufeature: replace X86_FEATURE_SYSENTER32 with X86_FEATURE_SYSFAST32 H. Peter Anvin
2026-01-06 21:18   ` [PATCH v4.1 10/10] x86/entry/vdso32: when using int $0x80, use it directly H. Peter Anvin
2026-01-15  7:00   ` [PATCH v4.1 00/10] x86/entry/vdso: clean up the vdso build, vdso updates Thorsten Leemhuis
2026-01-15 15:00     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176835148500.510.1892669351642514353.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®