On 04/20, Roland McGrath wrote:
>
> > Then re-take tasklist for reading and continue the reaping.
>
> You don't need tasklist_lock again, assuming you did do_notify_parent()
> while holding it for write (as done now).

Yes, probably you are right.

> > Hmm... looking at the current code in wait_task_zombie() under
> > "if (traced)", shouldn't we check !same_thread_group(p->real_parent, 
> > current)
> > before do_notify_parent() ?
>
> It's impossible.  ptrace_attach() doesn't allow it.

Yes, we can't trace the sub-thread. But ptrace_reparented() is true
when we trace the sub-thread's natural child.

IOW, 2 threads T1 and T2. T2 forks the child C. T1 ptraces C. C dies
and becomes EXIT_ZOMBIE. It sends the notification to thread-group.

Then, any thread does do_wait(). But since ptrace_reparented() = T
we don't release C but send the notification again. This doesn't
look right.

But the patch I sent was not right. I think we should do

        -       traced = ptrace_reparented(p);
        +       traced = !same_thread_group(parent, real_parent);

Or, perhaps better, we should change ptrace_reparented().
Another caller is tracehook_notify_death(), perhaps "other than our
normal parent" should mean other process, not thread.

Oleg.

Reply via email to