Re: Have RESOLVE_* flags superseded AT_* flags for new syscalls?

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

 



On 2020-03-02, David Howells <dhowells@xxxxxxxxxx> wrote:
> Christian Brauner <christian.brauner@xxxxxxxxxx> wrote:
> 
> > I think we settled this and can agree on RESOLVE_NO_SYMLINKS being the
> > right thing to do, i.e. not resolving symlinks will stay opt-in.
> > Or is your worry even with the current semantics of openat2()? I don't
> > see the issue since O_NOFOLLOW still works with openat2().
> 
> Say, for example, my home dir is on a network volume somewhere and /home has a
> symlink pointing to it.  RESOLVE_NO_SYMLINKS cannot be used to access a file
> inside my homedir if the pathwalk would go through /home/dhowells - this would
> affect fsinfo()

Yes, though this only happens if you're opening "/home/dhowells/foobar".
If you are doing "./foobar" from within "/home/dhowells" it will work
(or if you open a dirfd to "/home/dhowells") -- because no symlink
resolution is done as part of that openat2() call.

> So RESOLVE_NO_SYMLINKS is not a substitute for AT_SYMLINK_NOFOLLOW
> (O_NOFOLLOW would not come into it).

This is what I was saying up-thread -- the semantics are not the same
*on purpose*. If you want "don't follow symlinks *only for the final
component*" then you need to have an AT_SYMLINK_NOFOLLOW equivalent.

My counter-argument is that most people actually want
RESOLVE_NO_SYMLINKS (as evidenced by the countless symlink-related
security bugs -- many of which used O_NOFOLLOW incorrectly), it just
wasn't available before Linux 5.6.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Attachment: signature.asc
Description: PGP signature


[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