diff options
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/ptrace.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index bbd37536d14e..9969d212e94d 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c | |||
@@ -265,30 +265,16 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
265 | lock_kernel(); | 265 | lock_kernel(); |
266 | DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", | 266 | DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", |
267 | request, pid, addr, data)); | 267 | request, pid, addr, data)); |
268 | ret = -EPERM; | ||
269 | if (request == PTRACE_TRACEME) { | 268 | if (request == PTRACE_TRACEME) { |
270 | /* are we already being traced? */ | 269 | ret = ptrace_traceme(); |
271 | if (current->ptrace & PT_PTRACED) | ||
272 | goto out_notsk; | ||
273 | ret = security_ptrace(current->parent, current); | ||
274 | if (ret) | ||
275 | goto out_notsk; | ||
276 | /* set the ptrace bit in the process ptrace flags. */ | ||
277 | current->ptrace |= PT_PTRACED; | ||
278 | ret = 0; | ||
279 | goto out_notsk; | 270 | goto out_notsk; |
280 | } | 271 | } |
281 | if (pid == 1) /* you may not mess with init */ | ||
282 | goto out_notsk; | ||
283 | 272 | ||
284 | ret = -ESRCH; | 273 | child = ptrace_get_task_struct(pid); |
285 | read_lock(&tasklist_lock); | 274 | if (IS_ERR(child)) { |
286 | child = find_task_by_pid(pid); | 275 | ret = PTR_ERR(child); |
287 | if (child) | ||
288 | get_task_struct(child); | ||
289 | read_unlock(&tasklist_lock); | ||
290 | if (!child) | ||
291 | goto out_notsk; | 276 | goto out_notsk; |
277 | } | ||
292 | 278 | ||
293 | if (request == PTRACE_ATTACH) { | 279 | if (request == PTRACE_ATTACH) { |
294 | ret = ptrace_attach(child); | 280 | ret = ptrace_attach(child); |