diff options
Diffstat (limited to 'arch/m68k/kernel/ptrace.c')
-rw-r--r-- | arch/m68k/kernel/ptrace.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index f7f1d2e5b90b..7e54422685cf 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c | |||
@@ -121,48 +121,11 @@ void ptrace_disable(struct task_struct *child) | |||
121 | child->thread.work.syscall_trace = 0; | 121 | child->thread.work.syscall_trace = 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | 124 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
125 | { | 125 | { |
126 | struct task_struct *child; | ||
127 | unsigned long tmp; | 126 | unsigned long tmp; |
128 | int i, ret = 0; | 127 | int i, ret = 0; |
129 | 128 | ||
130 | lock_kernel(); | ||
131 | if (request == PTRACE_TRACEME) { | ||
132 | /* are we already being traced? */ | ||
133 | if (current->ptrace & PT_PTRACED) { | ||
134 | ret = -EPERM; | ||
135 | goto out; | ||
136 | } | ||
137 | /* set the ptrace bit in the process flags. */ | ||
138 | current->ptrace |= PT_PTRACED; | ||
139 | goto out; | ||
140 | } | ||
141 | read_lock(&tasklist_lock); | ||
142 | child = find_task_by_pid(pid); | ||
143 | if (child) | ||
144 | get_task_struct(child); | ||
145 | read_unlock(&tasklist_lock); | ||
146 | if (unlikely(!child)) { | ||
147 | ret = -ESRCH; | ||
148 | goto out; | ||
149 | } | ||
150 | |||
151 | /* you may not mess with init */ | ||
152 | if (unlikely(pid == 1)) { | ||
153 | ret = -EPERM; | ||
154 | goto out_tsk; | ||
155 | } | ||
156 | |||
157 | if (request == PTRACE_ATTACH) { | ||
158 | ret = ptrace_attach(child); | ||
159 | goto out_tsk; | ||
160 | } | ||
161 | |||
162 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
163 | if (ret) | ||
164 | goto out_tsk; | ||
165 | |||
166 | switch (request) { | 129 | switch (request) { |
167 | /* when I and D space are separate, these will need to be fixed. */ | 130 | /* when I and D space are separate, these will need to be fixed. */ |
168 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 131 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
@@ -317,14 +280,10 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | |||
317 | ret = ptrace_request(child, request, addr, data); | 280 | ret = ptrace_request(child, request, addr, data); |
318 | break; | 281 | break; |
319 | } | 282 | } |
320 | out_tsk: | 283 | |
321 | put_task_struct(child); | ||
322 | out: | ||
323 | unlock_kernel(); | ||
324 | return ret; | 284 | return ret; |
325 | out_eio: | 285 | out_eio: |
326 | ret = -EIO; | 286 | return -EIO; |
327 | goto out_tsk; | ||
328 | } | 287 | } |
329 | 288 | ||
330 | asmlinkage void syscall_trace(void) | 289 | asmlinkage void syscall_trace(void) |