Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs
From: Richard Weinberger <hidden>
Date: 2015-12-21 00:21:03
Also in:
linux-um, lkml
Am 21.12.2015 um 01:03 schrieb Mickaël Salaün:
quoted hunk ↗ jump to hunk
This fix two related bugs: * PTRACE_GETREGS doesn't get the right orig_ax (syscall) value * PTRACE_SETREGS can't set the orig_ax value (erased by initial value) Remove the now useless and error-prone get_syscall(). Signed-off-by: Mickaël Salaün <redacted> Cc: Jeff Dike <redacted> Cc: Richard Weinberger <richard-/L3Ra7n9ekc@public.gmane.org> Cc: Thomas Gleixner <redacted> Cc: Kees Cook <redacted> Cc: Andy Lutomirski <redacted> Cc: Will Drewry <redacted> Cc: Thomas Meyer <redacted> Cc: Nicolas Iooss <redacted> Cc: Anton Ivanov <redacted> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: user-mode-linux-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: user-mode-linux-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: Meredydd Luff <redacted> Cc: David Drysdale <redacted> --- arch/um/kernel/skas/syscall.c | 7 ++++++- arch/um/os-Linux/skas/process.c | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-)diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index 1683b8e..65f0d1a 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c@@ -7,6 +7,7 @@ #include <linux/ptrace.h> #include <kern_util.h> #include <sysdep/ptrace.h> +#include <sysdep/ptrace_user.h> #include <sysdep/syscalls.h> #include <os.h>@@ -16,12 +17,16 @@ void handle_syscall(struct uml_pt_regs *r) long result; int syscall; + /* Save the syscall register. */ + UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); + if (syscall_trace_enter(regs)) { result = -ENOSYS; goto out; } - syscall = get_syscall(r); + /* Get the syscall after being potentially updated with ptrace. */ + syscall = UPT_SYSCALL_NR(r);
Doesn't this break the support for changing syscall numbers using PTRACE_SETREGS? Thanks, //richard