freebsd-skq/sys/fs/smbfs
Kyle Evans 6a5abb1ee5 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
..
smbfs_io.c vfs: introduce v_irflag and make v_type smaller 2019-12-08 21:30:04 +00:00
smbfs_node.c Rework v_object lifecycle for vnodes. 2019-08-29 07:50:25 +00:00
smbfs_node.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
smbfs_smb.c sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
smbfs_subr.c sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
smbfs_subr.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
smbfs_vfsops.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
smbfs_vnops.c Provide O_SEARCH 2020-02-02 16:34:57 +00:00
smbfs.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00