[patch] test/leaderkill fix

Jan Kratochvil jan.kratochvil at redhat.com
Fri Jul 6 21:48:15 UTC 2007


here is a patch to fix the current testcase test/leaderkill (WAITPID on
a thread group where non-leader calls EXIT_GROUP).

The current PTRACE_KILL is there since Roland McGrath's original threads

-------------- next part --------------
2007-07-06  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* strace.c (handle_group_exit): Removed killing the threads leader.

--- strace.c	5 Jul 2007 20:03:16 -0000	1.80
+++ strace.c	6 Jul 2007 21:41:34 -0000
@@ -2121,22 +2121,17 @@ handle_group_exit(struct tcb *tcp, int s
 					/* We need to detach the leader so
 					   that the process death will be
 					   reported to its real parent.
-					   But we kill it first to prevent
-					   it doing anything before we kill
-					   the whole process in a moment.
-					   We can use PTRACE_KILL on a
-					   thread that's not already
-					   stopped.  Then the value we pass
-					   in PTRACE_DETACH just sets the
-					   death signal reported to the
-					   real parent.
-					   FIXME: This killing gets caught by
-					   WAITPID of the leader's parent.
+					   We neither kill it (as the killing
+					   would be returned to its parent by
+					   WAITPID) nor we stop it (as SIGSTOP
+					   could stop the whole process).
+					   If the leader does something
+					   unexpected there must be a race in
+					   the traced program.
 					   Testcase: test/leaderkill.c  */
-					ptrace(PTRACE_KILL, leader->pid, 0, 0);
 					if (debug)
-							" [%d exit %d kills %d]\n",
+							" [%d exit %d, leader %d]\n",
 							tcp->pid, sig, leader->pid);
 					detach(leader, sig);

More information about the Strace-devel mailing list