freebsd-skq/sys/fs/nfsclient
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
..
nfs_clbio.c (4/6) Protect page valid with the busy lock. 2019-10-15 03:45:41 +00:00
nfs_clcomsubs.c Delete an unused external declaration. 2019-12-08 16:59:36 +00:00
nfs_clkdtrace.c sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
nfs_clkrpc.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
nfs_clnfsiod.c Replace all mtx_assert() calls for n_mtx and ncl_iod_mutex with macros. 2019-09-26 02:54:45 +00:00
nfs_clnode.c Fix interface between nfsclient and vnode pager. 2019-10-22 16:17:38 +00:00
nfs_clport.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
nfs_clrpcops.c Silence some "might not be initialized" warnings for riscv64. 2019-12-13 21:38:08 +00:00
nfs_clstate.c Add support for NFSv4.2 to the NFS client and server. 2019-12-12 23:22:55 +00:00
nfs_clsubs.c Fix interface between nfsclient and vnode pager. 2019-10-22 16:17:38 +00:00
nfs_clvfsops.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
nfs_clvnops.c Provide O_SEARCH 2020-02-02 16:34:57 +00:00
nfs_kdtrace.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
nfs.h Remove "struct ucred*" argument from vtruncbuf 2019-05-24 20:27:50 +00:00
nfsmount.h Add support for NFSv4.2 to the NFS client and server. 2019-12-12 23:22:55 +00:00
nfsnode.h Fix interface between nfsclient and vnode pager. 2019-10-22 16:17:38 +00:00
nlminfo.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00