[Midnightbsd-cvs] [MidnightBSD/src] 5da1c7: Provide O_SEARCH
Lucas Holt
noreply at github.com
Sat Nov 14 15:10:12 EST 2020
Branch: refs/heads/master
Home: https://github.com/MidnightBSD/src
Commit: 5da1c7223bfb6f03313299f0bd8e3f57796a8e4d
https://github.com/MidnightBSD/src/commit/5da1c7223bfb6f03313299f0bd8e3f57796a8e4d
Author: Lucas Holt <luke at foolishgames.com>
Date: 2020-11-14 (Sat, 14 Nov 2020)
Changed paths:
M sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
M sys/fs/devfs/devfs_vnops.c
M sys/fs/fuse/fuse_vnops.c
M sys/fs/nfsclient/nfs_clvnops.c
M sys/fs/smbfs/smbfs_vnops.c
M sys/fs/tmpfs/tmpfs_vnops.c
M sys/kern/vfs_cache.c
M sys/kern/vfs_lookup.c
M sys/kern/vfs_subr.c
M sys/sys/fcntl.h
M sys/sys/namei.h
M sys/sys/vnode.h
Log Message:
-----------
Provide O_SEARCH
O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping
permissions checks on the directory itself after the initial open(). This is
close to the semantics we've historically applied for O_EXEC on a directory,
which is UB according to POSIX. Conveniently, O_SEARCH on a file is also
explicitly undefined behavior according to POSIX, so O_EXEC would be a fine
choice. The spec goes on to state that O_SEARCH and O_EXEC need not be
distinct values, but they're not defined to be the same value.
This was pointed out as an incompatibility with other systems that had made
its way into libarchive, which had assumed that O_EXEC was an alias for
O_SEARCH.
This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC
respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a
directory is checked in vn_open_vnode already, so for completeness we add a
NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not
re-check that when descending in namei.
More information about the Midnightbsd-cvs
mailing list