freebsd-skq/lib/libc/sys
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
..
__error.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
__vdso_gettimeofday.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
_exit.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
_umtx_op.2 Fix formatting of _umtx_op(2) 2017-11-13 17:46:38 +00:00
abort2.2
accept4.c
accept.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
accept.c
access.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
acct.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
adjtime.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
aio_cancel.2
aio_error.2
aio_fsync.2 Fix various nits in the aio operation manpages. 2016-08-19 17:37:32 +00:00
aio_mlock.2 Fix various nits in the aio operation manpages. 2016-08-19 17:37:32 +00:00
aio_read.2 Fix various nits in the aio operation manpages. 2016-08-19 17:37:32 +00:00
aio_return.2 Fully handle size_t lengths in AIO requests. 2016-03-21 21:37:33 +00:00
aio_suspend.2 Bump man page revision dates for r324941 2017-10-24 14:34:25 +00:00
aio_suspend.c
aio_waitcomplete.2 Fully handle size_t lengths in AIO requests. 2016-03-21 21:37:33 +00:00
aio_write.2 Fix various nits in the aio operation manpages. 2016-08-19 17:37:32 +00:00
bind.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
bindat.2 Clarify bindat/connectat use with AT_FDCWD 2018-04-30 17:16:17 +00:00
brk.2 Reimplement brk() and sbrk() to avoid the use of _end. 2018-06-04 19:35:15 +00:00
brk.c Reimplement brk() and sbrk() to avoid the use of _end. 2018-06-04 19:35:15 +00:00
cap_enter.2 cap_enter(2): fix manlint issues 2017-05-23 07:31:03 +00:00
cap_fcntls_limit.2
cap_ioctls_limit.2
cap_rights_limit.2
chdir.2 Mark all the system calls that were in 1st Edition Unix as such in the 2017-12-01 22:26:36 +00:00
chflags.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
chmod.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
chown.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
chroot.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
clock_gettime.2 clock_gettime(2): add a HISTORY section 2019-12-07 16:45:12 +00:00
clock_gettime.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
clock_nanosleep.c Remove 'All rights reserved' from my files 2018-05-09 20:12:59 +00:00
close.2 Mark all the system calls that were in 1st Edition Unix as such in the 2017-12-01 22:26:36 +00:00
close.c
closefrom.2
compat-ino64.h Regularize my copyright notice 2019-12-04 16:56:11 +00:00
compat-stub.c Remove bits of the old NUMA. 2018-07-10 22:00:20 +00:00
connect.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
connect.c
connectat.2 Clarify bindat/connectat use with AT_FDCWD 2018-04-30 17:16:17 +00:00
copy_file_range.2 Update the copy_file_range man page to reflect the semantic change 2019-11-10 01:13:41 +00:00
cpuset_getaffinity.2 Document new NUMA related syscalls and utility options. 2018-03-24 23:58:44 +00:00
cpuset_getdomain.2 Fix typos in the cpuset_{get,set}domain() man page. 2019-11-22 16:25:00 +00:00
cpuset.2 Fix cpuwhich_t column width 2019-09-08 21:37:52 +00:00
dup.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
execve.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
extattr_get_file.2
fcntl.2 vfs: provide F_ISUNIONSTACK as a kludge for libc 2020-01-17 14:42:25 +00:00
fcntl.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fdatasync.c The fdatasync(2) call must be cancellation point. 2016-08-16 08:27:03 +00:00
ffclock.2
fhlink.2 Add new file handle system calls. 2018-12-07 15:17:29 +00:00
fhopen.2
fhreadlink.2 Add new file handle system calls. 2018-12-07 15:17:29 +00:00
flock.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fork.2 Mark all the system calls that were in 1st Edition Unix as such in the 2017-12-01 22:26:36 +00:00
fork.c
fstat.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
fstatat.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
fstatfs.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
fsync.2 Don't put multiple names on a single .Nm line. This fixes apropos(1) 2018-04-17 09:05:46 +00:00
fsync.c
getdents.c Forward compatibility for ino64. 2017-06-23 18:06:20 +00:00
getdirentries.2 Add d_off support for multiple filesystems. 2018-11-14 14:18:35 +00:00
getdirentries.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
getdtablesize.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getfh.2 Remove special case handling for getfhat(fd, NULL, handle). 2018-12-11 02:48:49 +00:00
getfsstat.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getfsstat.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
getgid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getgroups.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getitimer.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getlogin.2 MAXLOGNAME changed to 33 in r243023. 2018-08-03 16:05:03 +00:00
getloginclass.2 MAXLOGNAME changed to 33 in r243023. 2018-08-03 16:05:03 +00:00
getpeername.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getpgrp.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getpid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getpriority.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getrandom.2 getrandom(2): Add Linux GRND_INSECURE API flag 2020-01-12 20:47:38 +00:00
getrlimit.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getrusage.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getsid.2
getsockname.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
getsockopt.2 getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable 2019-09-11 19:48:32 +00:00
gettimeofday.2 Bump .Dd forgotten in last commit. 2018-10-28 03:02:09 +00:00
gettimeofday.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
getuid.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
interposing_table.c Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
intro.2 Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
ioctl.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
issetugid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
jail.2 Revert r337922, except for some documention-only bits. This needs to wait 2018-08-16 19:09:43 +00:00
kenv.2 Make several improvements and corrections in the kenv(2) man page 2017-02-21 19:51:41 +00:00
kevent.c
kill.2 Only return EPERM from kill(-pid) when no process was signalled. 2019-12-07 18:07:49 +00:00
kldfind.2
kldfirstmod.2
kldload.2
kldnext.2
kldstat.2
kldsym.2 Use 'cmd' rather than 'command' to match the function prototype. 2016-10-17 22:36:37 +00:00
kldunload.2
kqueue.2 Allow a EVFILT_TIMER kevent to be updated. 2018-07-27 13:49:17 +00:00
ktrace.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
link.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
lio_listio.2 lio_listio(2): add a HISTORY section 2019-12-07 16:29:56 +00:00
listen.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
lseek.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
lstat.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
madvise.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
Makefile.inc Correct mistake in MLINKS introduced in r352747 2019-09-26 16:13:17 +00:00
mincore.2 Add a tunable which changes mincore(2) algorithm to only report data 2019-01-07 22:10:48 +00:00
minherit.2 Implement INHERIT_ZERO for minherit(2). 2017-03-14 17:10:42 +00:00
mkdir.2 Mark all the system calls that were in 1st Edition Unix as such in the 2017-12-01 22:26:36 +00:00
mkfifo.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
mknod.2 Fix missing .Dd bump 2017-12-01 22:52:45 +00:00
mknod.c Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
mlock.2 Provide separate accounting for user-wired pages. 2019-05-13 16:38:48 +00:00
mlockall.2 Provide separate accounting for user-wired pages. 2019-05-13 16:38:48 +00:00
mmap.2 Add PROT_MAX to the HISTORY section. 2019-06-20 21:52:30 +00:00
modfind.2 Use the right argumant name 2016-03-18 08:47:17 +00:00
modnext.2
modstat.2
mount.2 Add two options to allow mount to avoid covering up existing mount points. 2019-09-23 04:28:07 +00:00
mprotect.2 Add PROT_MAX to the HISTORY section. 2019-06-20 21:52:30 +00:00
mq_close.2
mq_getattr.2
mq_notify.2 Add documentation for the sigevent structure. 2016-07-15 15:12:56 +00:00
mq_open.2 Revert the mode_t -> int changes and add a warning in the BUGS section instead. 2019-09-28 17:15:48 +00:00
mq_receive.2
mq_send.2
mq_setattr.2
msgctl.2 Rename kernel-only members of semid_ds and msgid_ds. 2018-03-02 22:10:48 +00:00
msgget.2 Refer to SysV IPC permissions as numeric constants. 2018-03-04 20:06:02 +00:00
msgrcv.2 Change the return type of msgrcv() to ssize_t as required by POSIX. 2016-07-28 12:22:01 +00:00
msgsnd.2
msync.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
msync.c
munmap.2 Implement address space guards. 2017-06-24 17:01:11 +00:00
nanosleep.2 Add clock_nanosleep() 2017-03-19 00:51:12 +00:00
nanosleep.c
nfssvc.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
ntp_adjtime.2
open.2 Provide O_SEARCH 2020-02-02 16:34:57 +00:00
open.c
openat.c use @@@ instead of @@ in __sym_default 2017-12-05 20:19:13 +00:00
pathconf.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
pdfork.2 Add .Xrs to kqueue(2) from pdfork(2) and procdesc(4), to make EVFILT_PROCDESC 2018-10-14 18:42:54 +00:00
pipe.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
pipe.c Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
poll.2 poll.2: POLLNVAL is returned also for insufficient rights 2019-02-27 17:52:22 +00:00
poll.c
posix_fadvise.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
posix_fallocate.2 posix_fallocate: push vnop implementation into the fileop layer 2020-01-08 19:05:32 +00:00
posix_openpt.2 posix_openpt.2: Sort includes per style(9) 2016-09-21 17:51:27 +00:00
ppoll.c
procctl.2 Add procctl(PROC_STACKGAP_CTL) 2019-09-03 18:56:25 +00:00
profil.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
pselect.2
pselect.c
ptrace.2 Add ptrace op PT_GET_SC_RET. 2019-07-15 21:48:02 +00:00
ptrace.c Rewrite ptrace(2) wrappers in C. 2016-08-29 18:47:51 +00:00
quotactl.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rctl_add_rule.2 rctl_add_rule(2): fix manlint warnings 2017-05-23 07:32:57 +00:00
read.2 Document atomicity for read(2) and write(2). 2019-07-06 20:31:37 +00:00
read.c
readlink.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
readv.c
reboot.2 Tweak documentation to RB_ constants to reflect current use 2018-07-10 00:01:14 +00:00
recv.2 Update example to something people less than 40 years old have heard about. 2018-10-21 07:30:26 +00:00
recvfrom.c
recvmsg.c
rename.2 Add some words clarifying that rename(2) does nothing when the 'from' and 2018-06-21 15:21:17 +00:00
revoke.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rfork.2 posix_spawn(3): handle potential signal issues with vfork 2019-09-25 19:22:03 +00:00
rmdir.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rtprio.2 Remove "All rights reserved" from my files. 2018-05-10 06:41:08 +00:00
sched_get_priority_max.2
sched_setparam.2
sched_setscheduler.2
sched_yield.2
sctp_generic_recvmsg.2
sctp_generic_sendmsg.2
sctp_peeloff.2
select.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
select.c
semctl.2 Don't declare union semun in userspace unless _WANT_SEMUN is defined. 2018-03-02 22:32:53 +00:00
semget.2 Refer to SysV IPC permissions as numeric constants. 2018-03-04 20:06:02 +00:00
semop.2
send.2 Support MSG_DONTWAIT in send*(2). 2019-01-04 17:31:50 +00:00
sendfile.2 Imaginary cat jumped my keyboard! 2019-02-15 23:46:34 +00:00
sendmsg.c
sendto.c
setcontext.c use @@@ instead of @@ in __sym_default 2017-12-05 20:19:13 +00:00
setfib.2 Don't end up manpage titles with a full stop. 2017-05-24 21:02:53 +00:00
setgroups.2 Update .Dd missed in -r328304. 2018-01-24 22:36:21 +00:00
setpgid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
setregid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
setresuid.2
setreuid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
setsid.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
setuid.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
shm_open.2 Add an shm_rename syscall 2019-09-26 15:32:28 +00:00
shm_open.c memfd_create(3): Don't actually force hugetlb size with MFD_HUGETLB 2019-09-29 17:30:10 +00:00
shmat.2 Implement shmat(2) flag SHM_REMAP. 2019-01-16 05:15:57 +00:00
shmctl.2 Change the default setting of kern.ipc.shm_allow_removed from 0 to 1. 2015-10-10 09:29:47 +00:00
shmget.2 Refer to SysV IPC permissions as numeric constants. 2018-03-04 20:06:02 +00:00
shutdown.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigaction.2 sigaction.2: Minor cleanups 2018-06-28 18:17:20 +00:00
sigaction.c
sigaltstack.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigpending.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigprocmask.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigprocmask.c
sigqueue.2 Provide a freebsd32 implementation of sigqueue() 2017-05-05 18:49:39 +00:00
sigreturn.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigstack.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigsuspend.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sigsuspend.c
sigtimedwait.c
sigwait.2
sigwait.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
sigwaitinfo.2
sigwaitinfo.c
socket.2 Document socket control message routines for ancillary data access (CMSG_DATA). 2018-08-19 17:42:49 +00:00
socketpair.2 socketpair.2: Reference relevant POSIX standards 2018-02-10 19:41:32 +00:00
stat.2 Use consistent struct stat arg name in stat man page 2019-03-13 15:18:14 +00:00
stat.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
statfs.2 Add a reference to getfsstat in statfs. 2017-11-22 05:27:18 +00:00
statfs.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
swapcontext.c use @@@ instead of @@ in __sym_default 2017-12-05 20:19:13 +00:00
swapon.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
Symbol.map Add an shm_rename syscall 2019-09-26 15:32:28 +00:00
symlink.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sync.2 Correct history for Unix 2nd Edition through 6th Edition for the 2017-12-01 22:48:20 +00:00
sysarch.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
syscall.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
thr_exit.2 thr_*(2): Add xrefs to what libthr implements using each syscall. 2016-06-01 21:58:13 +00:00
thr_kill.2 thr_*(2): Add xrefs to what libthr implements using each syscall. 2016-06-01 21:58:13 +00:00
thr_new.2 Improve errno documentation in pthread_create(3) and thr_new(2) 2016-06-03 14:30:32 +00:00
thr_self.2 thr_*(2): Add xrefs to what libthr implements using each syscall. 2016-06-01 21:58:13 +00:00
thr_set_name.2 thr_set_name(): silently truncate the given name as needed 2016-12-03 01:14:21 +00:00
thr_suspend.2 Reword the statement. 2016-09-30 16:02:25 +00:00
thr_wake.2 thr_wake(2): Minor mdoc fixes 2019-01-06 21:34:05 +00:00
timer_create.2 Add documentation for the sigevent structure. 2016-07-15 15:12:56 +00:00
timer_delete.2
timer_settime.2
trivial-vdso_tc.c Implement userspace gettimeofday(2) with HPET timecounter. 2016-08-17 09:52:09 +00:00
truncate.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
umask.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
undelete.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
unlink.2 unlink: add missing function to unlink.2 man page 2019-06-05 22:36:19 +00:00
utimensat.2 First draft of documentation for AT/O_BENEATH handling of the absolute 2018-11-11 01:46:48 +00:00
utimes.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
utrace.2 mdoc: sort Xr 2016-01-18 20:21:38 +00:00
uuidgen.2
vadvise.c Make vadvise compat freebsd11. 2018-05-25 20:40:23 +00:00
vfork.2 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
wait4.c
wait6.c
wait.2 wait(2): clarify reparenting of children of the exiting process. 2019-08-11 15:47:48 +00:00
write.2 Mark all the system calls that were in 1st Edition Unix as such in the 2017-12-01 22:26:36 +00:00
write.c
writev.c