Commit 316f1f42 authored by Helge Deller's avatar Helge Deller

parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case

Wire up the missing ptrace requests PTRACE_GETREGS, PTRACE_SETREGS,
PTRACE_GETFPREGS and PTRACE_SETFPREGS when running 32-bit applications
on 64-bit kernels.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # 4.7+
parent 3f0c1780
...@@ -126,6 +126,12 @@ long arch_ptrace(struct task_struct *child, long request, ...@@ -126,6 +126,12 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long tmp; unsigned long tmp;
long ret = -EIO; long ret = -EIO;
unsigned long user_regs_struct_size = sizeof(struct user_regs_struct);
#ifdef CONFIG_64BIT
if (is_compat_task())
user_regs_struct_size /= 2;
#endif
switch (request) { switch (request) {
/* Read the word at location addr in the USER area. For ptraced /* Read the word at location addr in the USER area. For ptraced
...@@ -181,14 +187,14 @@ long arch_ptrace(struct task_struct *child, long request, ...@@ -181,14 +187,14 @@ long arch_ptrace(struct task_struct *child, long request,
return copy_regset_to_user(child, return copy_regset_to_user(child,
task_user_regset_view(current), task_user_regset_view(current),
REGSET_GENERAL, REGSET_GENERAL,
0, sizeof(struct user_regs_struct), 0, user_regs_struct_size,
datap); datap);
case PTRACE_SETREGS: /* Set all gp regs in the child. */ case PTRACE_SETREGS: /* Set all gp regs in the child. */
return copy_regset_from_user(child, return copy_regset_from_user(child,
task_user_regset_view(current), task_user_regset_view(current),
REGSET_GENERAL, REGSET_GENERAL,
0, sizeof(struct user_regs_struct), 0, user_regs_struct_size,
datap); datap);
case PTRACE_GETFPREGS: /* Get the child FPU state. */ case PTRACE_GETFPREGS: /* Get the child FPU state. */
...@@ -302,6 +308,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, ...@@ -302,6 +308,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
} }
} }
break; break;
case PTRACE_GETREGS:
case PTRACE_SETREGS:
case PTRACE_GETFPREGS:
case PTRACE_SETFPREGS:
return arch_ptrace(child, request, addr, data);
default: default:
ret = compat_ptrace_request(child, request, addr, data); ret = compat_ptrace_request(child, request, addr, data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment