2012-05-03 08:33:10

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: [PATCH] open(2): document O_PATH

Ted Ts'o <[email protected]> writes:

> It might also be a good idea to document explicitly whether or not
> things like fstat() and the syscalls to manipulate extended attributes
> are expected to work.
>

fstat won't work, but fstatat with an empty path name would work. O_PATH
descriptors are suppose to be used as "location only descriptors".
We then extended the *at syscalls to work with EMPTY pathnames so that
O_PATH descriptors can be used with readlink, fchownat and fstatat().
This was done to enable us to do these operation on symlinks.
(65cfc6722361570bfe255698d9cd4dccaf47570d)

Examples for O_PATH and handle syscall can be found in qemu and
handle-test repo

http://git.qemu.org/?p=qemu.git;a=blob;f=hw/9pfs/virtio-9p-handle.c;h=f96d17a9749a6f672741ff4dcb98da81d1dcc3ce;hb=HEAD
https://github.com/kvaneesh/handle-test/blob/master/handle.h

-aneesh


2012-05-03 13:07:30

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] open(2): document O_PATH

On Thu, May 03, 2012 at 01:57:21PM +0530, Aneesh Kumar K.V wrote:
>
> fstat won't work, but fstatat with an empty path name would work. O_PATH
> descriptors are suppose to be used as "location only descriptors".
> We then extended the *at syscalls to work with EMPTY pathnames so that
> O_PATH descriptors can be used with readlink, fchownat and fstatat().
> This was done to enable us to do these operation on symlinks.
> (65cfc6722361570bfe255698d9cd4dccaf47570d)

Could you define explicitly what you mean by "EMPTY" pathnames? Do
you mean a path name that doesn't exist? (i.e., one of the
directories specified in the pathname does not currently exist in the
directory hierarchy visible to the process).

- Ted

2012-05-03 13:20:38

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] open(2): document O_PATH

On Thu, May 03, 2012 at 09:07:07AM -0400, Ted Ts'o wrote:
> On Thu, May 03, 2012 at 01:57:21PM +0530, Aneesh Kumar K.V wrote:
> >
> > fstat won't work, but fstatat with an empty path name would work. O_PATH
> > descriptors are suppose to be used as "location only descriptors".
> > We then extended the *at syscalls to work with EMPTY pathnames so that
> > O_PATH descriptors can be used with readlink, fchownat and fstatat().
> > This was done to enable us to do these operation on symlinks.
> > (65cfc6722361570bfe255698d9cd4dccaf47570d)
>
> Could you define explicitly what you mean by "EMPTY" pathnames?

"". Normally yields -EINVAL when used as a relative pathname in ...at()
syscalls.

2012-05-06 01:00:41

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] open(2): document O_PATH

On 05/03/2012 01:27 AM, Aneesh Kumar K.V wrote:
>
> fstat won't work, but fstatat with an empty path name would work.

Why the h... make *such* a distinction?

-hpa