Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jun 2016 23:34:11 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Brooks Davis <brooks@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r302092 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/sys sys
Message-ID:  <20160623213411.GB5381@stack.nl>
In-Reply-To: <201606222111.u5MLBRHn090827@repo.freebsd.org>
References:  <201606222111.u5MLBRHn090827@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 22, 2016 at 09:11:27PM +0000, Brooks Davis wrote:
> Author: brooks
> Date: Wed Jun 22 21:11:27 2016
> New Revision: 302092
> URL: https://svnweb.freebsd.org/changeset/base/302092

> Log:
>   Replace use of the pipe(2) system call with pipe2(2) with a zero flags
>   value.

>   This eliminates the need for machine dependant assembly wrappers for
>   pipe(2).

I like it.

>   It also make passing an invalid address to pipe(2) return EFAULT rather
>   than triggering a segfault.  Document this behavior (which was already
>   true for pipe2(2), but undocumented).

It is valid to promise [EFAULT] in this specific case since the kernel
undoes the call's effects when the copyout fails (by closing the
descriptors) and it seems unlikely that we will need a userland wrapper
around pipe() or pipe2() that needs to access the created file
descriptors. However, POSIX does not require it: passing invalid
pointers to functions specified by the standard is undefined behaviour.

See r241001 for some man pages where I removed the [EFAULT] condition
because it is wrong for both reasons mentioned above (something changes
even after copyout failure and userland wrappers dereference pointers).

-- 
Jilles Tjoelker



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