aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/kernel/ptrace.c67
-rw-r--r--include/asm-x86/ptrace.h2
3 files changed, 11 insertions, 60 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index ae7158bce4d6..b5e329da166c 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -430,7 +430,7 @@ ia32_sys_call_table:
430 .quad sys_setuid16 430 .quad sys_setuid16
431 .quad sys_getuid16 431 .quad sys_getuid16
432 .quad compat_sys_stime /* stime */ /* 25 */ 432 .quad compat_sys_stime /* stime */ /* 25 */
433 .quad sys32_ptrace /* ptrace */ 433 .quad compat_sys_ptrace /* ptrace */
434 .quad sys_alarm 434 .quad sys_alarm
435 .quad sys_fstat /* (old)fstat */ 435 .quad sys_fstat /* (old)fstat */
436 .quad sys_pause 436 .quad sys_pause
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 870dc1023d2d..fb03ef380f0e 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1207,69 +1207,16 @@ static int genregs32_set(struct task_struct *target,
1207 return ret; 1207 return ret;
1208} 1208}
1209 1209
1210asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) 1210long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
1211 compat_ulong_t caddr, compat_ulong_t cdata)
1211{ 1212{
1212 struct task_struct *child; 1213 unsigned long addr = caddr;
1213 struct pt_regs *childregs; 1214 unsigned long data = cdata;
1214 void __user *datap = compat_ptr(data); 1215 void __user *datap = compat_ptr(data);
1215 int ret; 1216 int ret;
1216 __u32 val; 1217 __u32 val;
1217 1218
1218 switch (request) { 1219 switch (request) {
1219 case PTRACE_TRACEME:
1220 case PTRACE_ATTACH:
1221 case PTRACE_KILL:
1222 case PTRACE_CONT:
1223 case PTRACE_SINGLESTEP:
1224 case PTRACE_SINGLEBLOCK:
1225 case PTRACE_DETACH:
1226 case PTRACE_SYSCALL:
1227 case PTRACE_OLDSETOPTIONS:
1228 case PTRACE_SETOPTIONS:
1229 case PTRACE_SET_THREAD_AREA:
1230 case PTRACE_GET_THREAD_AREA:
1231#ifdef X86_BTS
1232 case PTRACE_BTS_CONFIG:
1233 case PTRACE_BTS_STATUS:
1234 case PTRACE_BTS_SIZE:
1235 case PTRACE_BTS_GET:
1236 case PTRACE_BTS_CLEAR:
1237 case PTRACE_BTS_DRAIN:
1238#endif
1239 return sys_ptrace(request, pid, addr, data);
1240
1241 default:
1242 return -EINVAL;
1243
1244 case PTRACE_PEEKTEXT:
1245 case PTRACE_PEEKDATA:
1246 case PTRACE_POKEDATA:
1247 case PTRACE_POKETEXT:
1248 case PTRACE_POKEUSR:
1249 case PTRACE_PEEKUSR:
1250 case PTRACE_GETREGS:
1251 case PTRACE_SETREGS:
1252 case PTRACE_SETFPREGS:
1253 case PTRACE_GETFPREGS:
1254 case PTRACE_SETFPXREGS:
1255 case PTRACE_GETFPXREGS:
1256 case PTRACE_GETEVENTMSG:
1257 case PTRACE_SETSIGINFO:
1258 case PTRACE_GETSIGINFO:
1259 break;
1260 }
1261
1262 child = ptrace_get_task_struct(pid);
1263 if (IS_ERR(child))
1264 return PTR_ERR(child);
1265
1266 ret = ptrace_check_attach(child, request == PTRACE_KILL);
1267 if (ret < 0)
1268 goto out;
1269
1270 childregs = task_pt_regs(child);
1271
1272 switch (request) {
1273 case PTRACE_PEEKUSR: 1220 case PTRACE_PEEKUSR:
1274 ret = getreg32(child, addr, &val); 1221 ret = getreg32(child, addr, &val);
1275 if (ret == 0) 1222 if (ret == 0)
@@ -1315,12 +1262,14 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
1315 sizeof(struct user32_fxsr_struct), 1262 sizeof(struct user32_fxsr_struct),
1316 datap); 1263 datap);
1317 1264
1265 case PTRACE_GET_THREAD_AREA:
1266 case PTRACE_SET_THREAD_AREA:
1267 return arch_ptrace(child, request, addr, data);
1268
1318 default: 1269 default:
1319 return compat_ptrace_request(child, request, addr, data); 1270 return compat_ptrace_request(child, request, addr, data);
1320 } 1271 }
1321 1272
1322 out:
1323 put_task_struct(child);
1324 return ret; 1273 return ret;
1325} 1274}
1326 1275
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index 24ec061566c5..9f922b0b95d6 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -231,6 +231,8 @@ extern int do_get_thread_area(struct task_struct *p, int idx,
231extern int do_set_thread_area(struct task_struct *p, int idx, 231extern int do_set_thread_area(struct task_struct *p, int idx,
232 struct user_desc __user *info, int can_allocate); 232 struct user_desc __user *info, int can_allocate);
233 233
234#define __ARCH_WANT_COMPAT_SYS_PTRACE
235
234#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
235 237
236#endif /* !__ASSEMBLY__ */ 238#endif /* !__ASSEMBLY__ */