I don't understand the "and not is a child on init's subthread".OK, sorry, I thought you mean the CLONE_PARENT case, where
If the child was created by init's sub-thread, it is the child
of the whole thread group.
->real_parent points to thread, yes.
But the parent is the wholeOK, now I see what problem you are pointing to.
process, not thread. The only reason for this oddity is __WNOTHREAD.
But the above code is under write_lock_irq(&tasklist_lock), so whyHow? I think I prevented that with this:Yes, thanks, I didn't notice "continue". But then this is wrong again.
---
+ p->detaching = 0;
+ continue;
This can race with wait_task_detached() called by our sub-thread, it
can clear ->detaching before we check it.