aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/ptrace.c')
-rw-r--r--arch/um/kernel/ptrace.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 71af4d503899..98e09395c093 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -43,53 +43,10 @@ void ptrace_disable(struct task_struct *child)
43extern int peek_user(struct task_struct * child, long addr, long data); 43extern int peek_user(struct task_struct * child, long addr, long data);
44extern int poke_user(struct task_struct * child, long addr, long data); 44extern int poke_user(struct task_struct * child, long addr, long data);
45 45
46long sys_ptrace(long request, long pid, long addr, long data) 46long arch_ptrace(struct task_struct *child, long request, long addr, long data)
47{ 47{
48 struct task_struct *child;
49 int i, ret; 48 int i, ret;
50 49
51 lock_kernel();
52 ret = -EPERM;
53 if (request == PTRACE_TRACEME) {
54 /* are we already being traced? */
55 if (current->ptrace & PT_PTRACED)
56 goto out;
57
58 ret = security_ptrace(current->parent, current);
59 if (ret)
60 goto out;
61
62 /* set the ptrace bit in the process flags. */
63 current->ptrace |= PT_PTRACED;
64 ret = 0;
65 goto out;
66 }
67 ret = -ESRCH;
68 read_lock(&tasklist_lock);
69 child = find_task_by_pid(pid);
70 if (child)
71 get_task_struct(child);
72 read_unlock(&tasklist_lock);
73 if (!child)
74 goto out;
75
76 ret = -EPERM;
77 if (pid == 1) /* you may not mess with init */
78 goto out_tsk;
79
80 if (request == PTRACE_ATTACH) {
81 ret = ptrace_attach(child);
82 goto out_tsk;
83 }
84
85#ifdef SUBACH_PTRACE_SPECIAL
86 SUBARCH_PTRACE_SPECIAL(child,request,addr,data);
87#endif
88
89 ret = ptrace_check_attach(child, request == PTRACE_KILL);
90 if (ret < 0)
91 goto out_tsk;
92
93 switch (request) { 50 switch (request) {
94 /* when I and D space are separate, these will need to be fixed. */ 51 /* when I and D space are separate, these will need to be fixed. */
95 case PTRACE_PEEKTEXT: /* read word at location addr. */ 52 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -282,10 +239,7 @@ long sys_ptrace(long request, long pid, long addr, long data)
282 ret = ptrace_request(child, request, addr, data); 239 ret = ptrace_request(child, request, addr, data);
283 break; 240 break;
284 } 241 }
285 out_tsk: 242
286 put_task_struct(child);
287 out:
288 unlock_kernel();
289 return ret; 243 return ret;
290} 244}
291 245