x86/entry/32: Convert do_fast_syscall_32() to bool return type
authorBrian Gerst <brgerst@gmail.com>
Fri, 21 Jul 2023 16:10:15 +0000 (12:10 -0400)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Oct 2023 08:06:42 +0000 (10:06 +0200)
Doesn't have to be 'long' - this simplifies the code a bit.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230721161018.50214-5-brgerst@gmail.com
arch/x86/entry/common.c
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64_compat.S
arch/x86/include/asm/syscall.h

index 328990dd86328bdc35a62c754ac4f10ae5fc7edc..f1f3bf150b57f63197362cdd4e0cd2cced9a61dd 100644 (file)
@@ -193,8 +193,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
@@ -212,7 +212,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
        /*
@@ -245,8 +245,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;
index 6e6af42e044a20cf0aec1115406c546ebcb3bbab..c73047bf9f4bff9c4631c0eab383cedceda41918 100644 (file)
@@ -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
index b16272395f1aad8a0d4b765d4d02d4c94aed92e3..27c05d08558aaadec8dea7ed8568036e277efd2c 100644 (file)
@@ -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
 
        /*
index 4fb36fba4b5a1f3034345eb640111a8f1f1573c7..c7e25c940f1a33a0decb87f7cb3b9102d8ee6f53 100644 (file)
@@ -131,7 +131,7 @@ void 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 */