Re: The XFS_IOC_FSGEOMETRY ioctl doesn't like fds that are opened O_PATH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 29, 2017 at 07:56:20PM -0700, Eric Biggers wrote:
> On Wed, Mar 29, 2017 at 05:23:28PM -0700, Darrick J. Wong wrote:
> > On Thu, Mar 30, 2017 at 12:57:08AM +0100, David Howells wrote:
> > > Should XFS_IOC_FSGEOMETRY work on fds that are opened O_PATH on an XFS
> > > filesystem?  Or should xfs_io not call that ioctl on O_PATH fds?
> > 
> > Given that read/write don't work under O_PATH, I wouldn't expect ioctls
> > to work either.
> > 
> > I tried to write a two line program to call FSGEOMETRY to see what
> > actually happens but got so bogged down in trying to figure out what
> > magic incantation of C headers one needs to pull in the appropriate
> > structure typedefs for an ioctl I wasn't even trying to call that I gave
> > up.
> > 
> > Seriously, what the f*ck do you have to #include just to be able to use
> > O_PATH?
> 
> From open(2):
> 
>       "The O_DIRECT, O_NOATIME, O_PATH, and  O_TMPFILE  flags  are
>       Linux-specific.  One must define _GNU_SOURCE to obtain their definitions."

Ah, thank you.  I missed that, having skipped straight to the section on
O_PATH... ($deity I hate userspace)

> Also, ioctl() with an O_PATH file descriptor always fails with EBADF because
> sys_ioctl() uses fdget() rather than fdget_raw().  The filesystem isn't involved
> at all.  This is intentional, I believe.

Yes, it is.

--D

> 
> - Eric



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux