minix/lib/libutil
David van Moolenbroek da21d85025 Add PTYFS, Unix98 pseudo terminal support
This patch adds support for Unix98 pseudo terminals, that is,
posix_openpt(3), grantpt(3), unlockpt(3), /dev/ptmx, and /dev/pts/.
The latter is implemented with a new pseudo file system, PTYFS.

In effect, this patch adds secure support for unprivileged pseudo
terminal allocation, allowing programs such as tmux(1) to be used by
non-root users as well.  Test77 has been extended with new tests, and
no longer needs to run as root.

The new functionality is optional.  To revert to the old behavior,
remove the "ptyfs" entry from /etc/fstab.

Technical nodes:

o The reason for not implementing the NetBSD /dev/ptm approach is that
  implementing the corresponding ioctl (TIOCPTMGET) would require
  adding a number of extremely hairy exceptions to VFS, including the
  PTY driver having to create new file descriptors for its own device
  nodes.

o PTYFS is required for Unix98 PTYs in order to avoid that the PTY
  driver has to be aware of old-style PTY naming schemes and even has
  to call chmod(2) on a disk-backed file system.  PTY cannot be its
  own PTYFS since a character driver may currently not also be a file
  system.  However, PTYFS may be subsumed into a DEVFS in the future.

o The Unix98 PTY behavior differs somewhat from NetBSD's, in that
  slave nodes are created on ptyfs only upon the first call to
  grantpt(3).  This approach obviates the need to revoke access as
  part of the grantpt(3) call.

o Shutting down PTY may leave slave nodes on PTYFS, but once PTY is
  restarted, these leftover slave nodes will be removed before they
  create a security risk.  Unmounting PTYFS will make existing PTY
  slaves permanently unavailable, and absence of PTYFS will block
  allocation of new Unix98 PTYs until PTYFS is (re)mounted.

Change-Id: I822b43ba32707c8815fd0f7d5bb7a438f51421c1
2015-06-23 17:43:46 +00:00
..
compat Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
disklabel_dkcksum.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
disklabel_dkcksum.c update/fix manpage support 2011-09-28 15:24:15 +00:00
disklabel_scan.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
disklabel_scan.c update/fix manpage support 2011-09-28 15:24:15 +00:00
efun.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
efun.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
getbootfile.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
getbootfile.c update/fix manpage support 2011-09-28 15:24:15 +00:00
getbyteorder.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
getbyteorder.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
getdiskrawname.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getdiskrawname.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getfsspecname.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getfsspecname.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
getfstypename.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getlabelsector.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getlabelsector.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
getmaxpartitions.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
getmaxpartitions.c update/fix manpage support 2011-09-28 15:24:15 +00:00
getmntopts.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
getmntopts.c update/fix manpage support 2011-09-28 15:24:15 +00:00
getrawpartition.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
getrawpartition.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
if_media.c update/fix manpage support 2011-09-28 15:24:15 +00:00
login.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
login.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
login_cap.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
login_cap.c Stub for setrlimit 2014-07-28 17:05:23 +02:00
login_tty.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
loginx.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
loginx.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
logout.c update/fix manpage support 2011-09-28 15:24:15 +00:00
logoutx.c update/fix manpage support 2011-09-28 15:24:15 +00:00
logwtmp.c update/fix manpage support 2011-09-28 15:24:15 +00:00
logwtmpx.c update/fix manpage support 2011-09-28 15:24:15 +00:00
Makefile Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
opendisk.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
opendisk.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
openpty.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
parsedate.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
parsedate.y Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
passwd.c Stub for setrlimit 2014-07-28 17:05:23 +02:00
pidfile.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
pidfile.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
pidlock.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
pidlock.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
proc_compare.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
pty.c Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
pw_getconf.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
pw_init.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
pw_lock.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
raise_default_signal.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
raise_default_signal.c update/fix manpage support 2011-09-28 15:24:15 +00:00
secure_path.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
secure_path.c update/fix manpage support 2011-09-28 15:24:15 +00:00
shlib_version Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
snprintb.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
sockaddr_snprintf.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
sockaddr_snprintf.c ARM: can build with llvm, switch to EABI 2014-12-12 13:04:56 +01:00
stat_flags.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
stat_flags.c update/fix manpage support 2011-09-28 15:24:15 +00:00
strpct.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
strpct.c Updating libutil from netbsd 2012-11-15 16:07:29 +01:00
ttyaction.3 update/fix manpage support 2011-09-28 15:24:15 +00:00
ttyaction.c update/fix manpage support 2011-09-28 15:24:15 +00:00
ttymsg.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
ttymsg.c update/fix manpage support 2011-09-28 15:24:15 +00:00
util.3 Updating libutil from netbsd 2012-11-15 16:07:29 +01:00