svn commit: r234352 - in head/sys: amd64/linux32 compat/linux i386/linux kern

Konstantin Belousov kostikbel at gmail.com
Wed Apr 18 12:16:12 UTC 2012


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 at 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:
> >  - Implement pipe2 syscall for Linuxulator.  This syscall appeared in 2.6.27
> >  but GNU libc used it without checking its kernel version, e. g., Fedora 10.
> >  - Move pipe(2) implementation for Linuxulator from MD files to MI file,
> >  sys/compat/linux/linux_file.c.  There is no MD code for this syscall at all.
> >  - Correct an argument type for pipe() from l_ulong * to l_int *.  Probably
> >  this was the source of MI/MD confusion.
> >
> >  Reviewed by:  emulation
> >
> > Modified:
> >  head/sys/amd64/linux32/linux32_dummy.c
> >  head/sys/amd64/linux32/linux32_machdep.c
> >  head/sys/amd64/linux32/syscalls.master
> >  head/sys/compat/linux/linux_file.c
> >  head/sys/i386/linux/linux_dummy.c
> >  head/sys/i386/linux/linux_machdep.c
> >  head/sys/i386/linux/syscalls.master
> >  head/sys/kern/sys_pipe.c
> >
> 
> 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 linux_pipe2
> to set appropriate flags for the pipes after you created them with kern_pipe.
> Please, take a look at this patch
> http://www.trematerra.net/patches/linux_pipe2.patch
> 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20120418/e4024f85/attachment.pgp


More information about the svn-src-head mailing list