NetBSD/share
dholland 723d09ce8e Add containment for the cloning devices hack in vn_open.
Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)
2021-06-29 22:40:53 +00:00
..
dict +craptacular 2020-07-16 03:08:58 +00:00
doc s/ be be / be / 2020-08-19 02:19:06 +00:00
examples Rename the block table to something else to make it easier to differentiate 2019-11-18 22:27:27 +00:00
i18n Add more aliases for Hebrew and Arabic ISO-8859-... encodings. 2018-06-08 12:07:41 +00:00
installboot Add missing Makefile. 2020-06-22 03:15:48 +00:00
legal Remove advertising clause from the code distributed from UCB 2020-10-19 15:25:57 +00:00
locale Fix the currency symbol for fi_FI.ISO8859-1 2020-03-23 13:56:12 +00:00
man Add containment for the cloning devices hack in vn_open. 2021-06-29 22:40:53 +00:00
me
misc EEE: embrace, extend, extinguish; or eastern equine encephalitis 2021-06-18 21:58:20 +00:00
mk switch m68000, m68k and 32 bit arm to GCC 10. just sh3 left! 2021-06-19 06:19:35 +00:00
nls
tabset
terminfo merge 20200606: resolve conflict by adding kb2 and rin entries to putty 2020-10-10 12:57:39 +00:00
tmac Provide ability to override <title> 2020-01-23 23:52:13 +00:00
wscons Update Spleen wscons fonts to version 1.9.0, bringing the following 2021-03-12 21:07:08 +00:00
xml
Makefile Add installboot(8) support for evbarm (and, in the future, other evb*) 2019-05-07 05:02:41 +00:00
Makefile.inc