From d6a32f176c7a07c72c69000c39a5a964e4168874 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 11 Jul 2007 08:35:11 +0000 Subject: [PATCH] 2007-07-11 Roland McGrath * strace.c (handle_group_exit): Detach TCP before LEADER. Don't use PTRACE_KILL on LEADER. --- strace.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/strace.c b/strace.c index d6423ef2..9e7f3fa3 100644 --- a/strace.c +++ b/strace.c @@ -2115,35 +2115,22 @@ handle_group_exit(struct tcb *tcp, int sig) /* Mark that we are taking the process down. */ tcp->flags |= TCB_EXITING | TCB_GROUP_EXITING; if (tcp->flags & TCB_ATTACHED) { + detach(tcp, sig); if (leader != NULL && leader != tcp) { if ((leader->flags & TCB_ATTACHED) && !(leader->flags & TCB_EXITING)) { /* 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. - Testcase: test/leaderkill.c */ - ptrace(PTRACE_KILL, leader->pid, 0, 0); + reported to its real parent. */ if (debug) fprintf(stderr, - " [%d exit %d kills %d]\n", + " [%d exit %d detaches %d]\n", tcp->pid, sig, leader->pid); detach(leader, sig); } else leader->flags |= TCB_GROUP_EXITING; } - detach(tcp, sig); } else if (ptrace(PTRACE_CONT, tcp->pid, (char *) 1, sig) < 0) { perror("strace: ptrace(PTRACE_CONT, ...)"); -- 2.40.0