From owner-svn-src-all@freebsd.org Thu Jun 23 21:34:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35075B73FD1; Thu, 23 Jun 2016 21:34:13 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F39E11C29; Thu, 23 Jun 2016 21:34:12 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 9BA86B80DB; Thu, 23 Jun 2016 23:34:10 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 6D24828494; Thu, 23 Jun 2016 23:34:11 +0200 (CEST) Date: Thu, 23 Jun 2016 23:34:11 +0200 From: Jilles Tjoelker To: Brooks Davis 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> References: <201606222111.u5MLBRHn090827@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201606222111.u5MLBRHn090827@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Thu, 23 Jun 2016 21:34:13 -0000 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