Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2008 12:37:47 -0400
From:      David Schultz <das@FreeBSD.ORG>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: Openat() and fexecve() committed
Message-ID:  <20080331163747.GA5468@zim.MIT.EDU>
In-Reply-To: <20080331153006.GK21209@deviant.kiev.zoral.com.ua>
References:  <20080331153006.GK21209@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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")?



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