[BusyBox] fork / vfork in init.c

Erik Andersen andersen at codepoet.org
Tue Oct 26 19:35:46 UTC 2004


On Tue Oct 26, 2004 at 05:22:21AM -0500, Rob Landley wrote:
> > I'd rather not do that.  It would be better to add a
> > 	[X] I am using uClinux
> > type config option, and make busybox init depend on !uClinux.  bb
> > init is simply not vfork safe, and adding such a config option is
> > not going to make it any safer.
> 
> I thought that vfork tended to block until the child process had returned...

vfork does block.  Or rather, when you vfork, you still have
exactly one process address space, which follows path A until an
exit() or exec(), and then proceeds along path B.  This causes
grief, since, unlike fork(), there is no COW, so any changes to
variables, stack content, etc during path A, is persistant for
path B.  Without great care, path B can be easily hosed up,

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the busybox mailing list