openpty() family of functions use /dev/ptm PTMGET to open a master+slave fd
authorderaadt <deraadt@openbsd.org>
Fri, 2 Sep 2022 07:37:57 +0000 (07:37 +0000)
committerderaadt <deraadt@openbsd.org>
Fri, 2 Sep 2022 07:37:57 +0000 (07:37 +0000)
commit46d2ff95b320a7a48fa0d233d0c8e282e61f294f
tree9e14991ddd9d57fd75be070380dfebc7899e5d14
parent74d1c2fcefb9dcbb9c7bc6915a5869322e794090
openpty() family of functions use /dev/ptm PTMGET to open a master+slave fd
pair, and also provides their names.  Internally, 3 NDINIT+namei operations
access /dev/[tp]ty[p-zP-T][0-9a-zA-Z], of these 2 followed unveil restrictions.
I argue if you unveil /dev/ptm, (and not the 372 other nodes), you still want
openpty() to provide you with working fd's, and the names, which the caller
will probably never open manually, because the fd's are given.
So change all NDINIT to use KERNELPATH, bypassing unveil.
ok semarie
sys/kern/tty_pty.c