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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to