Re: Openat() and fexecve() committed

From: David Schultz <das_at_FreeBSD.ORG>
Date: Mon, 31 Mar 2008 12:37:47 -0400
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")?
Received on Mon Mar 31 2008 - 14:35:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:29 UTC