]> err.no Git - linux-2.6/commitdiff
x86_64 ia32 ptrace: convert to compat_arch_ptrace
authorRoland McGrath <roland@redhat.com>
Tue, 22 Apr 2008 19:21:25 +0000 (12:21 -0700)
committerIngo Molnar <mingo@elte.hu>
Sat, 26 Apr 2008 15:35:47 +0000 (17:35 +0200)
Now that there are no more special cases in sys32_ptrace, we
can convert to using the generic compat_sys_ptrace entry point.
The sys32_ptrace function gets simpler and becomes compat_arch_ptrace.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/ia32/ia32entry.S
arch/x86/kernel/ptrace.c
include/asm-x86/ptrace.h

index ae7158bce4d62d6b0ec1bfec5c52ead3b3e48049..b5e329da166cfa2a48a74339a47539739ec939ac 100644 (file)
@@ -430,7 +430,7 @@ ia32_sys_call_table:
        .quad sys_setuid16
        .quad sys_getuid16
        .quad compat_sys_stime  /* stime */             /* 25 */
-       .quad sys32_ptrace      /* ptrace */
+       .quad compat_sys_ptrace /* ptrace */
        .quad sys_alarm
        .quad sys_fstat /* (old)fstat */
        .quad sys_pause
index 870dc1023d2daeffdede2123c534af6a63825e97..fb03ef380f0e230ebf5f3835bc7ec57e1c9fed20 100644 (file)
@@ -1207,68 +1207,15 @@ static int genregs32_set(struct task_struct *target,
        return ret;
 }
 
-asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
+long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+                       compat_ulong_t caddr, compat_ulong_t cdata)
 {
-       struct task_struct *child;
-       struct pt_regs *childregs;
+       unsigned long addr = caddr;
+       unsigned long data = cdata;
        void __user *datap = compat_ptr(data);
        int ret;
        __u32 val;
 
-       switch (request) {
-       case PTRACE_TRACEME:
-       case PTRACE_ATTACH:
-       case PTRACE_KILL:
-       case PTRACE_CONT:
-       case PTRACE_SINGLESTEP:
-       case PTRACE_SINGLEBLOCK:
-       case PTRACE_DETACH:
-       case PTRACE_SYSCALL:
-       case PTRACE_OLDSETOPTIONS:
-       case PTRACE_SETOPTIONS:
-       case PTRACE_SET_THREAD_AREA:
-       case PTRACE_GET_THREAD_AREA:
-#ifdef X86_BTS
-       case PTRACE_BTS_CONFIG:
-       case PTRACE_BTS_STATUS:
-       case PTRACE_BTS_SIZE:
-       case PTRACE_BTS_GET:
-       case PTRACE_BTS_CLEAR:
-       case PTRACE_BTS_DRAIN:
-#endif
-               return sys_ptrace(request, pid, addr, data);
-
-       default:
-               return -EINVAL;
-
-       case PTRACE_PEEKTEXT:
-       case PTRACE_PEEKDATA:
-       case PTRACE_POKEDATA:
-       case PTRACE_POKETEXT:
-       case PTRACE_POKEUSR:
-       case PTRACE_PEEKUSR:
-       case PTRACE_GETREGS:
-       case PTRACE_SETREGS:
-       case PTRACE_SETFPREGS:
-       case PTRACE_GETFPREGS:
-       case PTRACE_SETFPXREGS:
-       case PTRACE_GETFPXREGS:
-       case PTRACE_GETEVENTMSG:
-       case PTRACE_SETSIGINFO:
-       case PTRACE_GETSIGINFO:
-               break;
-       }
-
-       child = ptrace_get_task_struct(pid);
-       if (IS_ERR(child))
-               return PTR_ERR(child);
-
-       ret = ptrace_check_attach(child, request == PTRACE_KILL);
-       if (ret < 0)
-               goto out;
-
-       childregs = task_pt_regs(child);
-
        switch (request) {
        case PTRACE_PEEKUSR:
                ret = getreg32(child, addr, &val);
@@ -1315,12 +1262,14 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
                                             sizeof(struct user32_fxsr_struct),
                                             datap);
 
+       case PTRACE_GET_THREAD_AREA:
+       case PTRACE_SET_THREAD_AREA:
+               return arch_ptrace(child, request, addr, data);
+
        default:
                return compat_ptrace_request(child, request, addr, data);
        }
 
- out:
-       put_task_struct(child);
        return ret;
 }
 
index 24ec061566c541e4ba237e385a67b54f8092dc39..9f922b0b95d6d3961275c9cac804acf22cbb8ef6 100644 (file)
@@ -231,6 +231,8 @@ extern int do_get_thread_area(struct task_struct *p, int idx,
 extern int do_set_thread_area(struct task_struct *p, int idx,
                              struct user_desc __user *info, int can_allocate);
 
+#define __ARCH_WANT_COMPAT_SYS_PTRACE
+
 #endif /* __KERNEL__ */
 
 #endif /* !__ASSEMBLY__ */