Re: futimens use of utimensat does not support O_PATH fds

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

 



On Thu, Aug 07, 2025 at 02:01:15PM -0700, Josh Triplett wrote:
> I just discovered that opening a file with O_PATH gives an fd that works
> with
> 
> utimensat(fd, "", times, O_EMPTY_PATH)
> 
> but does *not* work with what futimens calls, which is:
> 
> utimensat(fd, NULL, times, 0)

It's in line with what we do for fchownat() and fchmodat2() iirc.
O_PATH as today is a broken concept imho. O_PATH file descriptors
should've never have gained the ability to meaningfully alter state. I
think it's broken that they can be used to change ownership or mode and
similar.

O_PATH file descriptors get file->f_op set to empty_fops when they're
opened. So anything that uses file operations is off-limits (read,
write, poll, mmap, sync etc.) but anything that uses inode_operations
(e.g., acl, setattr) or super operations isn't per se. So that scheme
isn't great. It shouldn't matter whether a write-like operation is
implemented on the file or inode level.

People do keep poking holes into O_PATH semantics at random. We're
constantly fighting off such attempts because they would break the few
useful promises that O_PATH file descriptors still give.




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

  Powered by Linux