Re: [path][rfc] add PR_DETACH prctl command
From: Oleg Nesterov
Date: Thu Feb 24 2011 - 10:40:44 EST
On 02/24, Stas Sergeev wrote:
> I am currently rewriting the patch to solve this all.
> What I am trying to do now, is to reparent directly in prctl(),
> but delay the list_move_tail(&p->sibling, &p->real_parent->children);
> to the wait() call.
Ooh... good luck ;) but I expect this won't be simple. In fact,
I do not understand how it is possible to do this correctly.
>> The problem is that ptrace uses this ->exit_code member as well.
>> Suppose that the (ptraced) task calls PR_DETACH and, say, recieves
>> a signal after that. See ptrace_signal().
> Also do_signal_stop() seems to alter it.
Yes. It is not immediately obvious but this is in fact for ptrace.
Even if this thread is not traced, the tracer can attach later.
> Do you mean right now it can't happen that multiple events
> alter the exit_code, and the parent notices only the last one?
> In this case I need to add a separate variable.
I'd suggest you to always report 0 as the exit status. Much simpler.
Then you can do another patch if you really want to report arg2.
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/