Skip to content

Commit 5d5675d

Browse files
amlutosuryasaimadhu
authored andcommitted
x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls
On a 32-bit fast syscall that fails to read its arguments from user memory, the kernel currently does syscall exit work but not syscall entry work. This confuses audit and ptrace. For example: $ ./tools/testing/selftests/x86/syscall_arg_fault_32 ... strace: pid 264258: entering, ptrace_syscall_info.op == 2 ... This is a minimal fix intended for ease of backporting. A more complete cleanup is coming. Fixes: 0b085e6 ("x86/entry: Consolidate 32/64 bit syscall entry") Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/8c82296ddf803b91f8d1e5eac89e5803ba54ab0e.1614884673.git.luto@kernel.org
1 parent b59cc97 commit 5d5675d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/x86/entry/common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
128128
regs->ax = -EFAULT;
129129

130130
instrumentation_end();
131-
syscall_exit_to_user_mode(regs);
131+
local_irq_disable();
132+
irqentry_exit_to_user_mode(regs);
132133
return false;
133134
}
134135

0 commit comments

Comments
 (0)