lkml.org 
[lkml]   [1999]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: vfork
From
Date
Linus,

I didn't see anyone comment, so I will. I'd like to see this change go in for
2.4. Without it, CLONE_PTRACE is not very useful.

I'm working on something that ptraces processes (a la strace), and this change
would be useful and perhaps required for doing this. (I'm not sure the
breakpoint loop trick strace uses will work in all cases for clone and vfork.)


On a different topic, does anyone know whether fork/vfork/clone calls are
"atomic"? Specifically, if the kernel's syscall_trace executes for a clone
entry, and then again for a clone exit, is it always the case that the two
syscall_trace calls are part of the same call? Or could clone entries and
exits interleave?

--Mike



Linus Torvalds <torvalds@transmeta.com> writes:
> 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
>
[ if ((clone_flags & CLONE_VFORK) || !(clone_flags & CLONE_PARENT)) { ]
> 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/
>
>

--
Any sufficiently adverse technology is indistinguishable from Microsoft.

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

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.102 / U:3.176 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site