Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2012 15:15:59 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Giovanni Trematerra <gianni@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim <jkim@freebsd.org>
Subject:   Re: svn commit: r234352 - in head/sys: amd64/linux32 compat/linux i386/linux kern
Message-ID:  <20120418121559.GY2358@deviant.kiev.zoral.com.ua>
In-Reply-To: <CACfq090w3-iGT=aHREuipXUxmZSxXnGt4gDARFQbZfL5pSsgxQ@mail.gmail.com>
References:  <201204162122.q3GLM23E051048@svn.freebsd.org> <CACfq090w3-iGT=aHREuipXUxmZSxXnGt4gDARFQbZfL5pSsgxQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <jkim@freebsd.org> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120418121559.GY2358>