From owner-svn-src-all@FreeBSD.ORG Wed Apr 18 12:16:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DF3106564A; Wed, 18 Apr 2012 12:16:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id BFE4E8FC14; Wed, 18 Apr 2012 12:16:11 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q3ICG0cj011127; Wed, 18 Apr 2012 15:16:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q3ICFxOo099208; Wed, 18 Apr 2012 15:15:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q3ICFxRi099207; Wed, 18 Apr 2012 15:15:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 18 Apr 2012 15:15:59 +0300 From: Konstantin Belousov To: Giovanni Trematerra Message-ID: <20120418121559.GY2358@deviant.kiev.zoral.com.ua> References: <201204162122.q3GLM23E051048@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vsmlMR5OrJFuyy4J" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim Subject: Re: svn commit: r234352 - in head/sys: amd64/linux32 compat/linux i386/linux kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2012 12:16:12 -0000 --vsmlMR5OrJFuyy4J Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 18, 2012 at 01:52:24PM +0200, Giovanni Trematerra wrote: > On Mon, Apr 16, 2012 at 11:22 PM, Jung-uk Kim wrote: > > Author: jkim > > Date: Mon Apr 16 21:22:02 2012 > > New Revision: 234352 > > URL: http://svn.freebsd.org/changeset/base/234352 > > > > Log: > > =9A- Implement pipe2 syscall for Linuxulator. =9AThis syscall appeared = in 2.6.27 > > =9Abut GNU libc used it without checking its kernel version, e. g., Fed= ora 10. > > =9A- Move pipe(2) implementation for Linuxulator from MD files to MI fi= le, > > =9Asys/compat/linux/linux_file.c. =9AThere is no MD code for this sysca= ll at all. > > =9A- Correct an argument type for pipe() from l_ulong * to l_int *. =9A= Probably > > =9Athis was the source of MI/MD confusion. > > > > =9AReviewed by: =9Aemulation > > > > Modified: > > =9Ahead/sys/amd64/linux32/linux32_dummy.c > > =9Ahead/sys/amd64/linux32/linux32_machdep.c > > =9Ahead/sys/amd64/linux32/syscalls.master > > =9Ahead/sys/compat/linux/linux_file.c > > =9Ahead/sys/i386/linux/linux_dummy.c > > =9Ahead/sys/i386/linux/linux_machdep.c > > =9Ahead/sys/i386/linux/syscalls.master > > =9Ahead/sys/kern/sys_pipe.c > > >=20 > I don't think it's worth to change sys/kern/sys_pipe.c just to implement > linux_pipe2 in linuxator. > You can just revert the changes in sys_pipe.c and call kern_fcntl in linu= x_pipe2 > to set appropriate flags for the pipes after you created them with kern_p= ipe. > Please, take a look at this patch > http://www.trematerra.net/patches/linux_pipe2.patch >=20 > It's only test-compiled though. > Thank you. I do think that what Jung-uk did is the right approach, and your suggestion is wrong. The way it is done in r234352 serves the purpose of pipe2(2), namely, the atomicity of setting O_CLOEXEC and O_NONBLOCK with respect to execve(2). You may argue that kern_execve() applies single-threading around the syscall implementation, so our thread cannot be inside the kern_pipe() while other thread performs execve(2). But unfortunately, this is only true for FreeBSD ABI, while linuxolator has very flawed execve() (and fork()) implementation. In particular, other threads are running while some thread performs fork or exec. So I think that the do_pipe() should be kept as is. --vsmlMR5OrJFuyy4J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk+OsH8ACgkQC3+MBN1Mb4hIxQCgrhHCS8tE9SKscWjtpeefDpQ4 1GwAoO2ppUfaJBadJuGbEMy7/UCCyu0W =hkko -----END PGP SIGNATURE----- --vsmlMR5OrJFuyy4J--