Date: Tue, 14 Aug 2012 11:18:30 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: David Xu <davidxu@freebsd.org> Cc: freebsd-hackers@freebsd.org, Jilles Tjoelker <jilles@stack.nl> Subject: Re: system() using vfork() or posix_spawn() and libthr Message-ID: <20120814081830.GA5883@deviant.kiev.zoral.com.ua> In-Reply-To: <5029D727.2090105@freebsd.org> References: <20120730102408.GA19983@stack.nl> <20120730105303.GU2676@deviant.kiev.zoral.com.ua> <20120805215432.GA28704@stack.nl> <20120806082535.GI2676@deviant.kiev.zoral.com.ua> <20120809105648.GA79814@stack.nl> <5029D727.2090105@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 14, 2012 at 12:42:15PM +0800, David Xu wrote: > I simply duplicated idea from OpenSolaris, here is my patch > which has similar feature as your patch, and it also tries to > prevent vforked child from corrupting parent's data: > http://people.freebsd.org/~davidxu/patch/libthr-vfork.diff You shall not return from vfork() frame in the child. Otherwise, the same frame is appears to be destroyed in parent, and parent dies. More often on !x86, but right combination of events on x86 is deadly too. If pid or curthread local variables are spilled into stack save area, then child will override them, and e.g. parent could see pid == 0, returning it to caller. This was the reason why I went to asm wrapper for vfork. Also, it seems that in mt process, malloc and rtld are still broken, or am I missing something ? --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlAqCdUACgkQC3+MBN1Mb4hL3gCdFjUzOQrAjCo5i3Fk8SWi6ikS NE0AoJRfTnfkfAf2Rl8IJM2kGXtw6WVB =0wd3 -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120814081830.GA5883>