Re: Behaviour of /proc/self/fd/NN

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

 



On Wed, Nov 14, 2018 at 11:45 AM, Nikolaus Rath <Nikolaus@xxxxxxxx> wrote:
> Hi,
>
> If I understand Documentation/filesystems/path-lookup.md correctly, then
> the "symlinks" in /proc/self/fd/NN are not true symlinks but just
> presented as such to userspace. Does this mean that I can access (e.g.,
> open(), setxattr(), or chmod()) these files without the possibility of
> race conditions? I.e., there is no way for someone to rename the target
> after the kernel has "looked up" the target but before the operation is
> applied?

Exactly.   The only limitation is that if the target is a symlink (fd
opened with O_PATH) then the neither the symlink following, nor the
non-following variants will do the right thing (see *xattr ops in
passthrough_ll for example).

> Secondly, under which conditions can I open the files in /proc? Does
> this still work if the destination file has been unlinked?

Yes.

> Does it
> always follow renames? What if I mounted something over the destination?

It works in all those cases.

Thanks,
Miklos



[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