Commit 691785fa authored by David S. Miller's avatar David S. Miller

On sparc{,64}, use ptrace_check_attach instead of

verifying things by hand.
parent 085c9a18
......@@ -278,6 +278,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned long data = regs->u_regs[UREG_I3];
unsigned long addr2 = regs->u_regs[UREG_I4];
struct task_struct *child;
int ret;
lock_kernel();
#ifdef DEBUG_PTRACE
......@@ -335,20 +336,13 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
pt_succ_return(regs, 0);
goto out_tsk;
}
if (!(child->ptrace & PT_PTRACED)) {
pt_error_return(regs, ESRCH);
goto out_tsk;
}
if(child->state != TASK_STOPPED) {
if(request != PTRACE_KILL) {
pt_error_return(regs, ESRCH);
goto out_tsk;
}
}
if(child->p_pptr != current) {
pt_error_return(regs, ESRCH);
ret = ptrace_check_attach(child, request == PTRACE_KILL);
if (ret < 0) {
pt_error_return(regs, -ret);
goto out_tsk;
}
switch(request) {
case PTRACE_PEEKTEXT: /* read word at location addr. */
case PTRACE_PEEKDATA: {
......
......@@ -122,6 +122,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned long data = regs->u_regs[UREG_I3];
unsigned long addr2 = regs->u_regs[UREG_I4];
struct task_struct *child;
int ret;
if (test_thread_flag(TIF_32BIT)) {
addr &= 0xffffffffUL;
......@@ -184,18 +185,10 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
pt_succ_return(regs, 0);
goto out_tsk;
}
if (!(child->ptrace & PT_PTRACED)) {
pt_error_return(regs, ESRCH);
goto out_tsk;
}
if (child->state != TASK_STOPPED) {
if (request != PTRACE_KILL) {
pt_error_return(regs, ESRCH);
goto out_tsk;
}
}
if (child->p_pptr != current) {
pt_error_return(regs, ESRCH);
ret = ptrace_check_attach(child, request == PTRACE_KILL);
if (ret < 0) {
pt_error_return(regs, -ret);
goto out_tsk;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment