From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
"Borislav Petkov" <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Mika Penttilä" <mpenttil@redhat.com>,
"Brian Gerst" <brgerst@gmail.com>
Subject: [PATCH v2 4/6] x86/entry/32: Convert do_fast_syscall_32() to bool return type
Date: Fri, 21 Jul 2023 12:10:15 -0400 [thread overview]
Message-ID: <20230721161018.50214-5-brgerst@gmail.com> (raw)
In-Reply-To: <20230721161018.50214-1-brgerst@gmail.com>
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/entry/common.c | 10 +++++-----
arch/x86/entry/entry_32.S | 2 +-
arch/x86/entry/entry_64_compat.S | 2 +-
arch/x86/include/asm/syscall.h | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index cccdd18c8304..5b3594457af3 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -220,8 +220,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
return true;
}
-/* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
-__visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
+/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */
+__visible noinstr bool do_fast_syscall_32(struct pt_regs *regs)
{
/*
* Called using the internal vDSO SYSENTER/SYSCALL32 calling
@@ -239,7 +239,7 @@ __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
/* Invoke the syscall. If it failed, keep it simple: use IRET. */
if (!__do_fast_syscall_32(regs))
- return 0;
+ return false;
#ifdef CONFIG_X86_64
/*
@@ -272,8 +272,8 @@ __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
#endif
}
-/* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
-__visible noinstr long do_SYSENTER_32(struct pt_regs *regs)
+/* Returns true to return using SYSEXIT/SYSRETL, or false to use IRET */
+__visible noinstr bool do_SYSENTER_32(struct pt_regs *regs)
{
/* SYSENTER loses RSP, but the vDSO saved it in RBP. */
regs->sp = regs->bp;
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 6e6af42e044a..c73047bf9f4b 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -837,7 +837,7 @@ SYM_FUNC_START(entry_SYSENTER_32)
movl %esp, %eax
call do_SYSENTER_32
- testl %eax, %eax
+ testb %al, %al
jz .Lsyscall_32_done
STACKLEAK_ERASE
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index b16272395f1a..27c05d08558a 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -212,7 +212,7 @@ SYM_INNER_LABEL(entry_SYSCALL_compat_after_hwframe, SYM_L_GLOBAL)
sysret32_from_system_call:
/* XEN PV guests always use IRET path */
- ALTERNATIVE "testl %eax, %eax; jz swapgs_restore_regs_and_return_to_usermode", \
+ ALTERNATIVE "testb %al, %al; jz swapgs_restore_regs_and_return_to_usermode", \
"jmp swapgs_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
/*
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index be6c5515e0b9..f44e2f9ab65d 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -131,7 +131,7 @@ bool do_syscall_64(struct pt_regs *regs, int nr);
#endif /* CONFIG_X86_32 */
void do_int80_syscall_32(struct pt_regs *regs);
-long do_fast_syscall_32(struct pt_regs *regs);
-long do_SYSENTER_32(struct pt_regs *regs);
+bool do_fast_syscall_32(struct pt_regs *regs);
+bool do_SYSENTER_32(struct pt_regs *regs);
#endif /* _ASM_X86_SYSCALL_H */
--
2.41.0
next prev parent reply other threads:[~2023-07-21 16:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 16:10 [PATCH v2 0/6] x86: Clean up fast syscall return validation Brian Gerst
2023-07-21 16:10 ` [PATCH v2 1/6] x86/entry/64: Remove obsolete comment on tracing vs. SYSRET Brian Gerst
2023-10-05 8:28 ` [tip: x86/entry] " tip-bot2 for Brian Gerst
2023-07-21 16:10 ` [PATCH v2 2/6] x86/entry/64: Convert SYSRET validation tests to C Brian Gerst
2023-07-23 9:53 ` Li, Xin3
2023-07-23 11:17 ` Brian Gerst
2023-07-21 16:10 ` [PATCH v2 3/6] x86/entry/compat: Combine return value test from syscall handler Brian Gerst
2023-10-05 8:28 ` [tip: x86/entry] " tip-bot2 for Brian Gerst
2023-07-21 16:10 ` Brian Gerst [this message]
2023-10-05 8:28 ` [tip: x86/entry] x86/entry/32: Convert do_fast_syscall_32() to bool return type tip-bot2 for Brian Gerst
2023-07-21 16:10 ` [PATCH v2 5/6] x86/entry/32: Remove SEP test for SYSEXIT Brian Gerst
2023-10-05 8:28 ` [tip: x86/entry] " tip-bot2 for Brian Gerst
2023-07-21 16:10 ` [PATCH v2 6/6] x86/entry/32: Clean up syscall fast exit tests Brian Gerst
2023-10-05 8:22 ` [PATCH v2 0/6] x86: Clean up fast syscall return validation Ingo Molnar
2023-10-05 15:13 ` Brian Gerst
2023-10-05 20:20 ` Ingo Molnar
2023-10-06 18:59 ` H. Peter Anvin
2023-10-06 21:32 ` Brian Gerst
2023-10-07 9:42 ` Ingo Molnar
2023-10-06 23:58 ` H. Peter Anvin
2023-10-07 9:56 ` Uros Bizjak
2023-10-07 18:07 ` Linus Torvalds
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=20230721161018.50214-5-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mpenttil@redhat.com \
--cc=tglx@linutronix.de \
--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
Powered by JetHome