patch-2.4.7 linux/arch/sh/kernel/ptrace.c

Next file: linux/arch/sparc/defconfig
Previous file: linux/arch/s390x/mm/fault.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/arch/sh/kernel/ptrace.c linux/arch/sh/kernel/ptrace.c
@@ -173,34 +173,7 @@
 		goto out_tsk;
 
 	if (request == PTRACE_ATTACH) {
-		if (child == tsk)
-			goto out_tsk;
-		if(((tsk->uid != child->euid) ||
-		    (tsk->uid != child->suid) ||
-		    (tsk->uid != child->uid) ||
-	 	    (tsk->gid != child->egid) ||
-	 	    (tsk->gid != child->sgid) ||
-	 	    (!cap_issubset(child->cap_permitted, tsk->cap_permitted)) ||
-	 	    (tsk->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
-			goto out_tsk;
-		rmb();
-		if (!child->dumpable && !capable(CAP_SYS_PTRACE))
-			goto out_tsk;
-		/* the same process cannot be attached many times */
-		if (child->ptrace & PT_PTRACED)
-			goto out_tsk;
-		child->ptrace |= PT_PTRACED;
-
-		write_lock_irq(&tasklist_lock);
-		if (child->p_pptr != tsk) {
-			REMOVE_LINKS(child);
-			child->p_pptr = tsk;
-			SET_LINKS(child);
-		}
-		write_unlock_irq(&tasklist_lock);
-
-		send_sig(SIGSTOP, child, 1);
-		ret = 0;
+		ret = ptrace_attach(child);
 		goto out_tsk;
 	}
 	ret = -ESRCH;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)