diff options
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/kernel/ptrace.c | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 18130c3748f3..b6fe202a620d 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -78,52 +78,13 @@ void ptrace_disable(struct task_struct *child) | |||
78 | pa_psw(child)->l = 0; | 78 | pa_psw(child)->l = 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | long sys_ptrace(long request, long pid, long addr, long data) | 81 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
82 | { | 82 | { |
83 | struct task_struct *child; | ||
84 | long ret; | 83 | long ret; |
85 | #ifdef DEBUG_PTRACE | 84 | #ifdef DEBUG_PTRACE |
86 | long oaddr=addr, odata=data; | 85 | long oaddr=addr, odata=data; |
87 | #endif | 86 | #endif |
88 | 87 | ||
89 | lock_kernel(); | ||
90 | ret = -EPERM; | ||
91 | if (request == PTRACE_TRACEME) { | ||
92 | /* are we already being traced? */ | ||
93 | if (current->ptrace & PT_PTRACED) | ||
94 | goto out; | ||
95 | |||
96 | ret = security_ptrace(current->parent, current); | ||
97 | if (ret) | ||
98 | goto out; | ||
99 | |||
100 | /* set the ptrace bit in the process flags. */ | ||
101 | current->ptrace |= PT_PTRACED; | ||
102 | ret = 0; | ||
103 | goto out; | ||
104 | } | ||
105 | |||
106 | ret = -ESRCH; | ||
107 | read_lock(&tasklist_lock); | ||
108 | child = find_task_by_pid(pid); | ||
109 | if (child) | ||
110 | get_task_struct(child); | ||
111 | read_unlock(&tasklist_lock); | ||
112 | if (!child) | ||
113 | goto out; | ||
114 | ret = -EPERM; | ||
115 | if (pid == 1) /* no messing around with init! */ | ||
116 | goto out_tsk; | ||
117 | |||
118 | if (request == PTRACE_ATTACH) { | ||
119 | ret = ptrace_attach(child); | ||
120 | goto out_tsk; | ||
121 | } | ||
122 | |||
123 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
124 | if (ret < 0) | ||
125 | goto out_tsk; | ||
126 | |||
127 | switch (request) { | 88 | switch (request) { |
128 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 89 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
129 | case PTRACE_PEEKDATA: { | 90 | case PTRACE_PEEKDATA: { |
@@ -383,11 +344,11 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
383 | 344 | ||
384 | case PTRACE_GETEVENTMSG: | 345 | case PTRACE_GETEVENTMSG: |
385 | ret = put_user(child->ptrace_message, (unsigned int __user *) data); | 346 | ret = put_user(child->ptrace_message, (unsigned int __user *) data); |
386 | goto out_tsk; | 347 | goto out; |
387 | 348 | ||
388 | default: | 349 | default: |
389 | ret = ptrace_request(child, request, addr, data); | 350 | ret = ptrace_request(child, request, addr, data); |
390 | goto out_tsk; | 351 | goto out; |
391 | } | 352 | } |
392 | 353 | ||
393 | out_wake_notrap: | 354 | out_wake_notrap: |
@@ -396,10 +357,7 @@ out_wake: | |||
396 | wake_up_process(child); | 357 | wake_up_process(child); |
397 | ret = 0; | 358 | ret = 0; |
398 | out_tsk: | 359 | out_tsk: |
399 | put_task_struct(child); | 360 | DBG("arch_ptrace(%ld, %d, %lx, %lx) returning %ld\n", |
400 | out: | ||
401 | unlock_kernel(); | ||
402 | DBG("sys_ptrace(%ld, %d, %lx, %lx) returning %ld\n", | ||
403 | request, pid, oaddr, odata, ret); | 361 | request, pid, oaddr, odata, ret); |
404 | return ret; | 362 | return ret; |
405 | } | 363 | } |