Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

From: Josh Triplett
Date: Sat Mar 14 2015 - 18:09:26 EST


On Sat, Mar 14, 2015 at 03:14:14PM +0100, Oleg Nesterov wrote:
> Again, again, I didn't read this series yet. But the proper solution (afaics)
> should move this "autoreap" check in release_task/__ptrace_detach(). If the
> task is traced. Debugger should check ->autoreap and skip another
> do_notify_parent().

As mentioned in the mail I just sent, I think I can just move the
autoreap handling *into* do_notify_parent, and treat it as though the
parent had SA_NOCLDWAIT set.

> Speaking of autoreap... If ->exit_signal is zero, then the exiting child
> doesn't send the notification to its parent, still it doesn't autoreap
> itself. To me this looks strange, and in fact it seems to me that this
> is only by mistake. I am wondering if we can treat ->exit_signal == 0
> as "autoreap" too. As usual, most probably the answer is "no, because it
> is too late to change the historical behaviour". But this is off-topic.

Historical behavior, and potentially sensible behavior; you might not
want notification, but you might still want to get the child's exit
status by calling wait, which means you need the process to stick around
as a zombie until you wait on it.

That'd be the main advantage of adding a CLONE_AUTOREAP flag: it allows
you to get the same autoreaping behavior you'd get if you had SIGCHLD
ignored, but without actually sending a signal and without caring how
the process-wide signal handling is set up. So you'd pass a 0 signal,
and CLONE_AUTOREAP. And then if you *want* the exit notification, you
can get it via the file descriptor.

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/