From owner-freebsd-current@FreeBSD.ORG Mon Mar 31 16:35:59 2008 Return-Path: Delivered-To: current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FEB2106564A for ; Mon, 31 Mar 2008 16:35:59 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id CF1BB8FC1C for ; Mon, 31 Mar 2008 16:35:58 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.2/8.14.2) with ESMTP id m2VGblPk005633; Mon, 31 Mar 2008 12:37:47 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.2/8.14.2/Submit) id m2VGblds005632; Mon, 31 Mar 2008 12:37:47 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Mon, 31 Mar 2008 12:37:47 -0400 From: David Schultz To: Kostik Belousov Message-ID: <20080331163747.GA5468@zim.MIT.EDU> Mail-Followup-To: Kostik Belousov , current@FreeBSD.ORG References: <20080331153006.GK21209@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080331153006.GK21209@deviant.kiev.zoral.com.ua> Cc: current@FreeBSD.ORG Subject: Re: Openat() and fexecve() committed X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2008 16:35:59 -0000 On Mon, Mar 31, 2008, Kostik Belousov wrote: > int main() { > int dfd = open("/tmp/foo", O_RDONLY); > int res; > > chmod("/tmp/foo", 0666); > > if (dfd != -1) { > res = openat(dfd, "bar", 0); > printf("OPENAT returns: %d, errno: %s\n", res, strerror(errno)); > } > > } > > gives the error EACCESS on both Linux and FreeBSD, and succeeds on Solaris. > The Solaris behaviour seems to be specified in the document cited above. > There are arguments in support of the both observed behaviour. Doesn't the latter behavior make it possible to bypass the usual permission checks on open("bar") via openat(AT_FDCWD, "bar")?