Re: [PATCH 2/2] ptrace children revamp
From: Oleg Nesterov
Date: Sun Apr 13 2008 - 11:18:30 EST
Sorry for delay!
On 04/09, Roland McGrath wrote:
>
> > Well, I was thinking about another thread (the new parent) sleeping in
> > do_wait(__WNOTHREAD)... not sure this really matters, though.
>
> I'm pretty sure it doesn't matter in real life. I doubt whoever uses
> __WNOTHREAD was relying on seeing some other thread's reparented
> children. TBH, I don't care much about __WNOTHREAD and I don't know off
> hand of anything that actually uses it.
Agreed. I never understood why we need __WNOTHREAD. The same for
->pdeath_signal in its current "per-thread" form. I think it would be
very nice to kill them both (or send the ->pdeath_signal when the whole
process exits). Then we can place all childrens on one signal->children
list. But this is a bit off-topic for now.
> I've put the latest tweaked version of this same patch series at:
> http://people.redhat.com/roland/kernel-patches/ptrace-cleanup.mbox
> That adds a fourth patch that fixes the aforementioned bug case that the
> current canonical kernel gets wrong. I think that fix also incidentally
> covered the init-ignores-SIGCHLD case, but I didn't test that and I'm
> not really positive.
I think the 4th patch has a small problem,
reparent_zombie:
if (p->exit_signal == -1 ||
(thread_group_empty(p) && ignoring_children(p->real_parent)))
list_add(&p->ptrace_list, dead);
The 2nd case, "thread_group_empty(p) && ignoring_children", looks racy.
We didn't set ->exit_signal == -1, the new parent can call do_wait() and
release "p" as soon as we drop tasklist_lock, before ptrace_exit_finish().
> I'm working on a variant of the ptrace revamp where all ptrace'd tasks
> go on a list (whether natural children or not). (This was my original
> intent, but then I thought it might be more complication and change that
> way. Now it's seeming attractive again.)
Yes! I thought about this too. Actually, I was very sure that this is your
plan from the the very beginning ;)
Oleg.
--
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/