aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv/kernel/ptrace.c')
-rw-r--r--arch/frv/kernel/ptrace.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c
index cb335a14a315..f953484e7d59 100644
--- a/arch/frv/kernel/ptrace.c
+++ b/arch/frv/kernel/ptrace.c
@@ -106,48 +106,11 @@ void ptrace_enable(struct task_struct *child)
106 child->thread.frame0->__status |= REG__STATUS_STEP; 106 child->thread.frame0->__status |= REG__STATUS_STEP;
107} 107}
108 108
109asmlinkage long sys_ptrace(long request, long pid, long addr, long data) 109long arch_ptrace(struct task_struct *child, long request, long addr, long data)
110{ 110{
111 struct task_struct *child;
112 unsigned long tmp; 111 unsigned long tmp;
113 int ret; 112 int ret;
114 113
115 lock_kernel();
116 ret = -EPERM;
117 if (request == PTRACE_TRACEME) {
118 /* are we already being traced? */
119 if (current->ptrace & PT_PTRACED)
120 goto out;
121 ret = security_ptrace(current->parent, current);
122 if (ret)
123 goto out;
124 /* set the ptrace bit in the process flags. */
125 current->ptrace |= PT_PTRACED;
126 ret = 0;
127 goto out;
128 }
129 ret = -ESRCH;
130 read_lock(&tasklist_lock);
131 child = find_task_by_pid(pid);
132 if (child)
133 get_task_struct(child);
134 read_unlock(&tasklist_lock);
135 if (!child)
136 goto out;
137
138 ret = -EPERM;
139 if (pid == 1) /* you may not mess with init */
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) { 114 switch (request) {
152 /* when I and D space are separate, these will need to be fixed. */ 115 /* when I and D space are separate, these will need to be fixed. */
153 case PTRACE_PEEKTEXT: /* read word at location addr. */ 116 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -351,10 +314,6 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
351 ret = -EIO; 314 ret = -EIO;
352 break; 315 break;
353 } 316 }
354out_tsk:
355 put_task_struct(child);
356out:
357 unlock_kernel();
358 return ret; 317 return ret;
359} 318}
360 319