freebsd-skq/sys/fs
kevans 11e74d9fa2 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.

[0] https://pubs.opengroup.org/onlinepubs/9699919799/

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D23247
2020-02-02 16:34:57 +00:00
..
autofs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
cd9660 vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
cuse Free all allocated unit IDs in cuse(3) after the client character 2019-06-25 11:46:01 +00:00
deadfs vfs: flatten vop vectors 2019-12-16 00:06:22 +00:00
devfs Provide O_SEARCH 2020-02-02 16:34:57 +00:00
ext2fs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
fdescfs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
fifofs vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
fuse Provide O_SEARCH 2020-02-02 16:34:57 +00:00
msdosfs Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOS 2020-01-27 12:02:41 +00:00
nfs Add missing comma in nfsv4_errstr 2020-01-13 21:49:27 +00:00
nfsclient Provide O_SEARCH 2020-02-02 16:34:57 +00:00
nfsserver Fix a crash in the NFSv4 server. 2020-01-26 17:59:05 +00:00
nullfs vfs: remove the never set VDESC_VPP_WILLRELE flag 2020-02-02 09:35:48 +00:00
procfs Define macro VM_MAP_ENTRY_FOREACH for enumerating the entries in a vm_map. 2019-10-08 07:14:21 +00:00
pseudofs pseudofs: don't do VEXEC check in VOP_CACHEDLOOKUP 2020-02-02 15:36:12 +00:00
smbfs Provide O_SEARCH 2020-02-02 16:34:57 +00:00
tmpfs Provide O_SEARCH 2020-02-02 16:34:57 +00:00
udf vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
unionfs vfs: provide F_ISUNIONSTACK as a kludge for libc 2020-01-17 14:42:25 +00:00