From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kh3YY-0004Z6-Dz for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:35:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kh3YU-0004UA-Ps for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:35:29 -0400 Received: from [199.232.76.173] (port=58761 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kh3YU-0004U5-Mo for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:35:26 -0400 Received: from rv-out-0708.google.com ([209.85.198.242]:49692) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kh3YU-0006dv-7p for qemu-devel@nongnu.org; Sat, 20 Sep 2008 10:35:26 -0400 Received: by rv-out-0708.google.com with SMTP id f25so738923rvb.22 for ; Sat, 20 Sep 2008 07:35:25 -0700 (PDT) Message-ID: Date: Sat, 20 Sep 2008 16:35:25 +0200 From: "andrzej zaborowski" Subject: Re: [Qemu-devel] [PATCH] Fix vfork() syscall emulation In-Reply-To: <20080920142051.GA27083@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1221750426-14863-1-git-send-email-kirill@shutemov.name> <20080920064556.GA24679@localhost.localdomain> <20080920131134.GA26850@localhost.localdomain> <20080920142051.GA27083@localhost.localdomain> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Kirill A. Shutemov" Cc: qemu-devel@nongnu.org, Paul Brook 2008/9/20 Kirill A. Shutemov : > 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. >> >> Agreed, but implementation of vfork() using fork() is wrong, too. > > Why? > > 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 > 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. Ok, perhaps I'm nit picking. clone(2) specifies some semantics for CLONE_VFORK regardless of the purpose and this implementation is nowhere near these semantics. I'll just add the same comment that klibc has and push the patch. Cheers