From: Andrew Morton <akpm@osdl.org>
To: Andrea Arcangeli <andrea@suse.de>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
Roland McGrath <roland@redhat.com>
Subject: Re: zombie with CLONE_THREAD
Date: Tue, 29 Jun 2004 23:08:04 -0700 [thread overview]
Message-ID: <20040629230804.3e9ed144.akpm@osdl.org> (raw)
In-Reply-To: <20040630060016.GP13406@dualathlon.random>
Andrea Arcangeli <andrea@suse.de> wrote:
>
> Hello,
>
> I debugged a problem with CLONE_THREAD under strace generating zombies
> that cannot be reaped by init.
>
> Basically what's going on is that release_task is never called on the
> clones, and in turn the parent thread will remain zombie forever because
> thread_group_empty == 0 (it never notifies init). the group can become
> empty only after release_task has been called on all the clones.
>
> What's going on is that if the clone happen to be under strace by the
> time it exits its state will not be set to TASK_DEAD and nobody will
> ever call wait4 on the clone because the parent is being killed at the
> same time. But the parent cannot go away until the clone goes away too.
> I believe strace needs as well a little race where it has the sigchld
> disabled but what I'm discussing here is still a kernel bug generating
> zombie threads.
>
> I think I could have fixed even with a strictier patch (adding a
> exit_signal == -1 check just to cover that case), but I believe that it
> makes no sense to leave ptrace enabled on a clone that is being killed,
> it happens to be safe without a thread-group just because there will be
> always init able to call wait4->release_task on it, that will call
> ptrace_unlink later in release_task, same goes for the "leader" of the
> thread group, that as well can be detached by ptrace via release_task).
>
> so far this thing worked fine in practice. Would be nice to hear a
> comment from somebody who understand this CLONE_THREAD signal
> mess^Wstuff with ptrace better.
Maybe Linus or Roland could comment.
> --- sles/kernel/exit.c.~1~ 2004-06-30 01:41:58.000000000 +0200
> +++ sles/kernel/exit.c 2004-06-30 07:49:21.705154000 +0200
> @@ -734,6 +734,13 @@ static void exit_notify(struct task_stru
> do_notify_parent(tsk, SIGCHLD);
> }
>
> + /*
> + * To allow the group leader of a thread group to be released
> + * we must really go away synchronously if exit_signal == -1.
> + */
> + if (unlikely(tsk->ptrace) && tsk != tsk->group_leader)
> + __ptrace_unlink(tsk);
> +
Should this be using thread_group_leader()?
next prev parent reply other threads:[~2004-06-30 6:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-30 6:00 Andrea Arcangeli
2004-06-30 6:08 ` Andrew Morton [this message]
2004-06-30 7:14 ` Roland McGrath
2004-06-30 9:04 ` Andreas Schwab
2004-07-01 3:22 ` Roland McGrath
2004-07-01 4:08 ` Andrea Arcangeli
2004-07-01 4:42 ` Linus Torvalds
2004-07-01 5:39 ` Roland McGrath
2004-07-01 5:56 ` Linus Torvalds
2004-07-01 7:06 ` Roland McGrath
2004-07-01 14:26 ` Andrea Arcangeli
2004-07-01 21:33 ` Roland McGrath
2004-07-01 15:49 ` Linus Torvalds
2004-07-01 16:23 ` Andrea Arcangeli
2004-07-01 16:43 ` Linus Torvalds
2004-07-01 20:27 ` Roland McGrath
2004-07-01 4:57 ` Linus Torvalds
2004-07-01 7:02 ` Roland McGrath
2004-07-01 16:50 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040629230804.3e9ed144.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®