lkml.org 
[lkml]   [2011]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [path][rfc] add PR_DETACH prctl command
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?

Yes.

> 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.

Oleg.



\
 
 \ /
  Last update: 2011-02-24 16:43    [W:0.174 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site