Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1295719
| From | Mickaël Salaün <mic@digikod.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs |
| Date | 2015-12-21 01:20 +0100 |
| Message-ID | <qHWmK-7Gv-7@gated-at.bofh.it> (permalink) |
| References | <qHWd4-7CW-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <mic@digikod.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: Thomas Meyer <thomas@m3y3r.de>
Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Anton Ivanov <aivanov@brocade.com>
Cc: linux-kernel@vger.kernel.org
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: Meredydd Luff <meredydd@senatehouse.org>
Cc: David Drysdale <drysdale@google.com>
---
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);
if ((syscall > __NR_syscall_max) || syscall < 0)
result = -ENOSYS;
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index b856c66..23025d6 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -172,13 +172,6 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
handle_syscall(regs);
}
-int get_syscall(struct uml_pt_regs *regs)
-{
- UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->gp);
-
- return UPT_SYSCALL_NR(regs);
-}
-
extern char __syscall_stub_start[];
static int userspace_tramp(void *stack)
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1 0/4] um: Add seccomp support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:10 +0100
[PATCH v1 4/4] um: Add seccomp support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:20 +0100
[PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:20 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 01:30 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 10:00 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 10:10 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 10:30 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 11:20 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 21:00 +0100
Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 10:20 +0100
[PATCH v1 2/4] selftests/seccomp: Remove the need for HAVE_ARCH_TRACEHOOK Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:30 +0100
[PATCH v1 3/4] um: Add full asm/syscall.h support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:30 +0100
csiph-web