[PATCH v3 0/3] ptrace-vs-syscall-restart fixes, v3

From: Andy Lutomirski
Date: Mon Jun 20 2016 - 20:05:42 EST


Now that I have a complete fix and cleanup that I like, here it is.
Patch 1 is the same as before except for a config-dependent build
fix.

This series is a cleanup and fixes at least two bugs:

- 64-bit gdb attached to a 32-bit program malfunctions if the user
types something like "print foo()" while stopped on exit from an
interrupted ERESTART_RESTARTBLOCK-using syscall.

- A 32-bit tracer that writes orig_eax while the tracee is stopped
at syscall entry will break in_ia32_syscall() and
syscall_get_arch().

After this is applied, it might be safe to drop all of the TS_COMPAT
checks in syscall.h, but I'd want to think carefully about that.

The reason that patch 1 is here at all instead of being folded into
the other patches is that it's intended to be cleanly and safely
backported if needed.

Patch 1 is for 4.7 or 4.8 at the maintainers' discretion. It could
also make sense for -stable -- I thing it fixes a bug that could be
exploited to confuse the syscall auit logs. Patch 2 and 3 are
intended for 4.8.

Pedro, can you try to test this series a bit? I'm having trouble
getting ptrace-tests to pass even on an unmodified kernel.

Andy Lutomirski (3):
x86/ptrace: Stop setting TS_COMPAT in ptrace code
x86/signal: Rewire the restart_block() syscall to have a constant nr
x86/ptrace, x86/signal: Remove TS_I386_REGS_POKED

arch/x86/entry/syscalls/syscall_32.tbl | 2 ++
arch/x86/entry/syscalls/syscall_64.tbl | 3 +++
arch/x86/include/asm/syscall.h | 3 ---
arch/x86/kernel/ptrace.c | 34 +++++++++++++++++++++-------------
arch/x86/kernel/signal.c | 16 ++++++++++------
5 files changed, 36 insertions(+), 22 deletions(-)

--
2.5.5