diff options
author | Richard Weinberger <richard@nod.at> | 2017-04-01 00:41:57 +0200 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-05-17 15:08:24 -0400 |
commit | e895a1054e2542b7762fad5a4095d65f4d293471 (patch) | |
tree | 4d55c11fbd555fea52aed01b26443807f1d95c6e /arch/x86 | |
parent | 327d78550aea59481ef99d500b42927c3735ae5b (diff) |
um: Fix PTRACE_POKEUSER on x86_64
[ Upstream commit 9abc74a22d85ab29cef9896a2582a530da7e79bf ]
This is broken since ever but sadly nobody noticed.
Recent versions of GDB set DR_CONTROL unconditionally and
UML dies due to a heap corruption. It turns out that
the PTRACE_POKEUSER was copy&pasted from i386 and assumes
that addresses are 4 bytes long.
Fix that by using 8 as address size in the calculation.
Cc: <stable@vger.kernel.org>
Reported-by: jie cao <cj3054@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/um/ptrace_64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/um/ptrace_64.c b/arch/x86/um/ptrace_64.c index 3b52bf0b418a..b0d25e6ef464 100644 --- a/arch/x86/um/ptrace_64.c +++ b/arch/x86/um/ptrace_64.c @@ -120,7 +120,7 @@ int poke_user(struct task_struct *child, long addr, long data) else if ((addr >= offsetof(struct user, u_debugreg[0])) && (addr <= offsetof(struct user, u_debugreg[7]))) { addr -= offsetof(struct user, u_debugreg[0]); - addr = addr >> 2; + addr = addr >> 3; if ((addr == 4) || (addr == 5)) return -EIO; child->thread.arch.debugregs[addr] = data; |