patch-2.4.15 linux/arch/i386/kernel/ptrace.c

Next file: linux/arch/i386/kernel/semaphore.c
Previous file: linux/arch/i386/kernel/pci-pc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c
@@ -181,15 +181,11 @@
 		ret = ptrace_attach(child);
 		goto out_tsk;
 	}
-	ret = -ESRCH;
-	if (!(child->ptrace & PT_PTRACED))
-		goto out_tsk;
-	if (child->state != TASK_STOPPED) {
-		if (request != PTRACE_KILL)
-			goto out_tsk;
-	}
-	if (child->p_pptr != current)
+
+	ret = ptrace_check_attach(child, request == PTRACE_KILL);
+	if (ret < 0)
 		goto out_tsk;
+
 	switch (request) {
 	/* when I and D space are separate, these will need to be fixed. */
 	case PTRACE_PEEKTEXT: /* read word at location addr. */ 

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