openat, mkdirat, and TOCTOU for directory creation

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

 



Hiya! I'm looking into the mkdirat and openat syscalls, and I noticed
that there's no means of implementing TOCTOU (time-of-check to
time-of-use, a technique for preventing race conditions) on directory
creation.

To create a directory and obtain a dirfd for it, you have to (1)
mkdirat, then (2) openat with O_DIRECTORY, and if the directory is
removed in between, the latter will fail.

One possibly straightforward solution is to support openat with the
O_DIRECTORY and O_CREAT flags specified.

The present behavior of this flag combination is to create a file and
return ENOTDIR. The appropriate behavior is probably to create a
directory as proposed, or, at a minimum, to return EINVAL and not create
the file.




[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