Skip to content

Commit 316f1f4

Browse files
committed
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: Helge Deller <[email protected]> Cc: [email protected] # 4.7+
1 parent 3f0c178 commit 316f1f4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

arch/parisc/kernel/ptrace.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ long arch_ptrace(struct task_struct *child, long request,
126126
unsigned long tmp;
127127
long ret = -EIO;
128128

129+
unsigned long user_regs_struct_size = sizeof(struct user_regs_struct);
130+
#ifdef CONFIG_64BIT
131+
if (is_compat_task())
132+
user_regs_struct_size /= 2;
133+
#endif
134+
129135
switch (request) {
130136

131137
/* 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,
181187
return copy_regset_to_user(child,
182188
task_user_regset_view(current),
183189
REGSET_GENERAL,
184-
0, sizeof(struct user_regs_struct),
190+
0, user_regs_struct_size,
185191
datap);
186192

187193
case PTRACE_SETREGS: /* Set all gp regs in the child. */
188194
return copy_regset_from_user(child,
189195
task_user_regset_view(current),
190196
REGSET_GENERAL,
191-
0, sizeof(struct user_regs_struct),
197+
0, user_regs_struct_size,
192198
datap);
193199

194200
case PTRACE_GETFPREGS: /* Get the child FPU state. */
@@ -302,6 +308,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
302308
}
303309
}
304310
break;
311+
case PTRACE_GETREGS:
312+
case PTRACE_SETREGS:
313+
case PTRACE_GETFPREGS:
314+
case PTRACE_SETFPREGS:
315+
return arch_ptrace(child, request, addr, data);
305316

306317
default:
307318
ret = compat_ptrace_request(child, request, addr, data);

0 commit comments

Comments
 (0)