Re: vfork

Kai Henningsen (kaih@khms.westfalen.de)
10 Nov 1999 19:31:00 +0200


torvalds@transmeta.com (Linus Torvalds) wrote on 10.11.99 in <Pine.LNX.4.10.9911100913340.2231-100000@penguin.transmeta.com>:

> On 10 Nov 1999, Kai Henningsen wrote:
> >
> > Well, in 2.2.12 it seems strace can't follow vfork()s without some kernel
> > patch. Or so I gather from the docs and the failure to perform.
> >
> > Is this better in 2.3.*?
>
> I always thought that was just because strace didn't understand about
> vfork().
>
> On the other hand, maybe it's a generic problem with strace - if it gets
> the child PID from the return value of "fork()", and attaches to it that
> way, that has two problems:
> - it won't work reliably even under normal fork(), as it's timing-
> dependent, and by the time strace has attached to the child the child
> might have already done several system calls.
> - it would fail completely with vfork(), as vfork() only returns after
> the child has execve'd

This is from the man page:

.B \-f
Trace child processes as they are created by currently traced
processes as a result of the
.BR fork (2)
system call. The new process is
attached to as soon as its pid is known (through the return value of
.BR fork (2)
in the parent process). This means that such children may run
uncontrolled for a while (especially in the case of a
.BR vfork (2)),
until the parent is scheduled again to complete its
.RB ( v ) fork (2)
call.
If the parent process decides to
.BR wait (2)
for a child that is currently
being traced, it is suspended until an appropriate child process either
terminates or incurs a signal that would cause it to terminate (as
determined from the child's current signal disposition).
.TP

.B \-F
Attempt to follow
.BR vfork s.
(On SunOS 4.x, this is accomplished with
some dynamic linking trickery. On Linux, it requires some kernel
functionality not yet in the standard kernel.) Otherwise,
.BR vfork s
will
not be followed even if
.B \-f
has been given.
.TP

> Who's maintaining strace these days?

This is the copyright as found in the upstream sources:

Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
Copyright (c) 1995, 1996 Michael Elizabeth Chastain <mec@duracef.shout.net>
Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>

I'm using the Debian version. This are the last changelog entries:

strace (4.0-1.1) unstable; urgency=low

* Non-maintainer upload for ARM.
* Removed hack in signal.c - no longer needed.

-- Jim Pick <jim@jimpick.com> Fri, 9 Jul 1999 15:45:25 -0700

strace (4.0-1) unstable; urgency=low

* New upstream version

-- Wichert Akkerman <wakkerma@debian.org> Fri, 9 Jul 1999 16:12:34 +0200

strace (3.99.1-1) unstable; urgency=low

* New upstream version, second pre-release for 4.0

-- Wichert Akkerman <wakkerma@debian.org> Wed, 9 Jun 1999 15:20:42 +0200

strace (3.99-1) unstable; urgency=low

* New upstream maintainer (me :)
* New upstream version, pre-release for strace 4.0
* See upstream changelog for changes
* Build with glibc2.1

-- Wichert Akkerman <wakkerma@debian.org> Tue, 27 Apr 1999 14:00:15 +0200

So I guess Wichert is the guy to talk to. I'll send him a copy, too.

MfG Kai

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