]> git.baikalelectronics.ru Git - kernel.git/commit
x86/entry: Unbreak 32bit fast syscall
authorThomas Gleixner <tglx@linutronix.de>
Tue, 1 Sep 2020 23:50:54 +0000 (01:50 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 4 Sep 2020 13:50:14 +0000 (15:50 +0200)
commit5a11cda22e8a5fb11d945234823d8da95627edab
treeddb9a047283999071caad1f0ea5b1e5f3e27c703
parent8d05a4be6dec1c24fae9699d961fce2b989b5552
x86/entry: Unbreak 32bit fast syscall

Andy reported that the syscall treacing for 32bit fast syscall fails:

# ./tools/testing/selftests/x86/ptrace_syscall_32
...
[RUN] SYSEMU
[FAIL] Initial args are wrong (nr=224, args=10 11 12 13 14 4289172732)
...
[RUN] SYSCALL
[FAIL] Initial args are wrong (nr=29, args=0 0 0 0 0 4289172732)

The eason is that the conversion to generic entry code moved the retrieval
of the sixth argument (EBP) after the point where the syscall entry work
runs, i.e. ptrace, seccomp, audit...

Unbreak it by providing a split up version of syscall_enter_from_user_mode().

- syscall_enter_from_user_mode_prepare() establishes state and enables
  interrupts

- syscall_enter_from_user_mode_work() runs the entry work

Replace the call to syscall_enter_from_user_mode() in the 32bit fast
syscall C-entry with the split functions and stick the EBP retrieval
between them.

Fixes: 532ff64aaf2e ("x86/entry: Use generic syscall entry function")
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/87k0xdjbtt.fsf@nanos.tec.linutronix.de
arch/x86/entry/common.c
include/linux/entry-common.h
kernel/entry/common.c