From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kh3Jm-0007MX-Gg for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:20:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kh3Jk-0007Le-7j for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:20:13 -0400 Received: from [199.232.76.173] (port=50241 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kh3Jk-0007LX-4U for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:20:12 -0400 Received: from fk-out-0910.google.com ([209.85.128.187]:50941) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kh3Jj-0003TI-GF for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:20:11 -0400 Received: by fk-out-0910.google.com with SMTP id 18so938754fks.2 for ; Sat, 20 Sep 2008 07:20:10 -0700 (PDT) Date: Sat, 20 Sep 2008 17:20:56 +0300 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] [PATCH] Fix vfork() syscall emulation Message-ID: <20080920142051.GA27083@localhost.localdomain> References: <1221750426-14863-1-git-send-email-kirill@shutemov.name> <20080920064556.GA24679@localhost.localdomain> <20080920131134.GA26850@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: andrzej zaborowski Cc: qemu-devel@nongnu.org, Paul Brook --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 20, 2008 at 03:52:55PM +0200, andrzej zaborowski wrote: > 2008/9/20 Kirill A. Shutemov : > > So, implementation vfork() using pthread is wrong. >=20 > Agreed, but implementation of vfork() using fork() is wrong, too. Why?=20 man 2 vfork(): BUGS It is rather unfortunate that Linux revived this specter from the past. The BSD man page states: "This system call will be eliminated when proper system sharing mechanisms are implemented. Users should not depend on the memory sharing semantics of vfork() as it will, in that case, be made synonymous to fork(2)." If any program doesn't work with vfork() implemented using fork(). it's=20 program bug. > If > we allow a hack, it should be commented, the second thing that needs > to be commented is why the value of CLONE_VM flag is ignored if > CLONE_VFORK is set -- on Linux it's not ignored. vfork() is a hack itself. It was introduced when fork() was very expensive. Linux fork() is implemented using copy-on-write pages, so the only penalty= =20 incurred by fork() is the time and memory required to duplicate the parent's page tables. It's quite cheap. So I think emulate vfork() using fork() is= =20 correct. --=20 Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/ --DocE+STaALJfprDB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkjVBsMACgkQbWYnhzC5v6odxACfdHTpiVxz9+0Plxt8I4dK3fAE TzoAniZIpf7m/Mbl4bnII5FvZPMUB7B3 =PdpY -----END PGP SIGNATURE----- --DocE+STaALJfprDB--