diff options
Diffstat (limited to 'arch/xtensa/kernel/ptrace.c')
-rw-r--r-- | arch/xtensa/kernel/ptrace.c | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 14460743de07..ab5c4c65b5c4 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c | |||
@@ -45,58 +45,10 @@ void ptrace_disable(struct task_struct *child) | |||
45 | /* Nothing to do.. */ | 45 | /* Nothing to do.. */ |
46 | } | 46 | } |
47 | 47 | ||
48 | long sys_ptrace(long request, long pid, long addr, long data) | 48 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
49 | { | 49 | { |
50 | struct task_struct *child; | ||
51 | int ret = -EPERM; | 50 | int ret = -EPERM; |
52 | 51 | ||
53 | lock_kernel(); | ||
54 | |||
55 | #if 0 | ||
56 | if ((int)request != 1) | ||
57 | printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", | ||
58 | (int) request, (int) pid, (unsigned long) addr, | ||
59 | (unsigned long) data); | ||
60 | #endif | ||
61 | |||
62 | if (request == PTRACE_TRACEME) { | ||
63 | |||
64 | /* Are we already being traced? */ | ||
65 | |||
66 | if (current->ptrace & PT_PTRACED) | ||
67 | goto out; | ||
68 | |||
69 | if ((ret = security_ptrace(current->parent, current))) | ||
70 | goto out; | ||
71 | |||
72 | /* Set the ptrace bit in the process flags. */ | ||
73 | |||
74 | current->ptrace |= PT_PTRACED; | ||
75 | ret = 0; | ||
76 | goto out; | ||
77 | } | ||
78 | |||
79 | ret = -ESRCH; | ||
80 | read_lock(&tasklist_lock); | ||
81 | child = find_task_by_pid(pid); | ||
82 | if (child) | ||
83 | get_task_struct(child); | ||
84 | read_unlock(&tasklist_lock); | ||
85 | if (!child) | ||
86 | goto out; | ||
87 | |||
88 | ret = -EPERM; | ||
89 | if (pid == 1) /* you may not mess with init */ | ||
90 | goto out; | ||
91 | |||
92 | if (request == PTRACE_ATTACH) { | ||
93 | ret = ptrace_attach(child); | ||
94 | goto out_tsk; | ||
95 | } | ||
96 | |||
97 | if ((ret = ptrace_check_attach(child, request == PTRACE_KILL)) < 0) | ||
98 | goto out_tsk; | ||
99 | |||
100 | switch (request) { | 52 | switch (request) { |
101 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 53 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
102 | case PTRACE_PEEKDATA: | 54 | case PTRACE_PEEKDATA: |
@@ -375,10 +327,7 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
375 | ret = ptrace_request(child, request, addr, data); | 327 | ret = ptrace_request(child, request, addr, data); |
376 | goto out; | 328 | goto out; |
377 | } | 329 | } |
378 | out_tsk: | 330 | out: |
379 | put_task_struct(child); | ||
380 | out: | ||
381 | unlock_kernel(); | ||
382 | return ret; | 331 | return ret; |
383 | } | 332 | } |
384 | 333 | ||