Tracing of vfork

Nate Eldredge (nate@cartsys.com)
Fri, 26 Feb 1999 18:00:29 -0800


I would like `strace' to be able to trace through `vfork', just like it
does with `fork'. Currently, this is impossible. `vfork' blocks the
parent until the child is finished, and the fork tracing mechanism in
strace involves sending the child into a loop until the parent's fork
returns, at which point the child is know by PID and can be attached.

So, obviously, it won't work as is. `strace' handles this predicament
on SunOS by patching the dynamic-link tables to make `vfork' just do
`fork', but I don't like this for Linux. It won't work with statically
linked binaries, which are often just what you most want to trace.

Thus, as far as I can tell, the only way to implement this is within the
kernel. I would like for it to be possible to have the `vfork' system
call really just act like plain `fork' when tracing is underway. This
could be done either: (a) anytime the process is traced, and we insert
some mechanism for `strace' to find out if it's being done, or (b) on
the basis of a new process flag, set by a new PTRACE call.

I'm as reluctant as the next person to see gratuitous features added to
the kernel, but I can't see any other good way of accomplishing this.
AFAICT, the changes should be small, and I don't think they should hurt
anything. After all, `vfork' used to be just `fork' since time
immemoriam.

Comments? CC to me would be appreciated if convenient.

Thanks for reading,

-- 

Nate Eldredge nate@cartsys.com

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