Re: vfork

Linus Torvalds (torvalds@transmeta.com)
Wed, 10 Nov 1999 11:44:04 -0800 (PST)


On Wed, 10 Nov 1999, Linus Torvalds wrote:
>
> It also requires the tracer to turn a fork()/vfork() into a clone(), but I
> guess that's ok. The lack of re-parenting looks like a killer, though.

Hmm.. A sufficient fix for that might be kernel/fork.c:

if ((clone_flags & CLONE_VFORK) || !(clone_flags & CLONE_PARENT))
p->p_pptr = p->p_opptr = current;

would instead become

p->p_opptr = current;
if (!(clone_flags & CLONE_PARENT))
p->p_pptr = current;

ie the original parent would _always_ be the "real" parent - which is what
CLONE_VFORK has to use anyway, but CLONE_PARENT would make the "logical
parent" be the same as the cloner. This should make debugging happy (the
debugger stays as the logical parent), yet should be ok for pthreads like
behaviour too, ie the reason for CLONE_PARENT in the first place.

Comments?

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/