aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v32/kernel/ptrace.c')
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 208489da2a87..5528b83a622b 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -99,55 +99,11 @@ ptrace_disable(struct task_struct *child)
99} 99}
100 100
101 101
102asmlinkage int 102long arch_ptrace(struct task_struct *child, long request, long addr, long data)
103sys_ptrace(long request, long pid, long addr, long data)
104{ 103{
105 struct task_struct *child;
106 int ret; 104 int ret;
107 unsigned long __user *datap = (unsigned long __user *)data; 105 unsigned long __user *datap = (unsigned long __user *)data;
108 106
109 lock_kernel();
110 ret = -EPERM;
111
112 if (request == PTRACE_TRACEME) {
113 /* are we already being traced? */
114 if (current->ptrace & PT_PTRACED)
115 goto out;
116 ret = security_ptrace(current->parent, current);
117 if (ret)
118 goto out;
119 /* set the ptrace bit in the process flags. */
120 current->ptrace |= PT_PTRACED;
121 ret = 0;
122 goto out;
123 }
124
125 ret = -ESRCH;
126 read_lock(&tasklist_lock);
127 child = find_task_by_pid(pid);
128
129 if (child)
130 get_task_struct(child);
131
132 read_unlock(&tasklist_lock);
133
134 if (!child)
135 goto out;
136
137 ret = -EPERM;
138
139 if (pid == 1) /* Leave the init process alone! */
140 goto out_tsk;
141
142 if (request == PTRACE_ATTACH) {
143 ret = ptrace_attach(child);
144 goto out_tsk;
145 }
146
147 ret = ptrace_check_attach(child, request == PTRACE_KILL);
148 if (ret < 0)
149 goto out_tsk;
150
151 switch (request) { 107 switch (request) {
152 /* Read word at location address. */ 108 /* Read word at location address. */
153 case PTRACE_PEEKTEXT: 109 case PTRACE_PEEKTEXT:
@@ -347,10 +303,7 @@ sys_ptrace(long request, long pid, long addr, long data)
347 ret = ptrace_request(child, request, addr, data); 303 ret = ptrace_request(child, request, addr, data);
348 break; 304 break;
349 } 305 }
350out_tsk: 306
351 put_task_struct(child);
352out:
353 unlock_kernel();
354 return ret; 307 return ret;
355} 308}
356 309