Go to file
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
bin Importing bin/dd 2015-04-15 13:50:57 +02:00
common inet: do not link against libc 2015-06-07 14:38:12 +00:00
distrib Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
docs Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
etc Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
external ARM: can build with llvm, switch to EABI 2014-12-12 13:04:56 +01:00
games Import games/caesar and games/rot13 2015-04-15 09:47:27 +02:00
gnu Update download urls in fetch.sh 2014-08-07 14:27:32 +02:00
include New sources layout 2014-07-31 16:00:30 +02:00
lib Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
libexec LLVM Minix changes 2014-07-28 17:05:59 +02:00
minix Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
releasetools Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
sbin INIT died problem / build system robustness 2014-08-28 08:52:50 +02:00
share ARM: can build with llvm, switch to EABI 2014-12-12 13:04:56 +01:00
sys libsa: add string precision support to vprintf 2015-02-10 13:47:28 +00:00
tests LLVM Minix changes 2014-07-28 17:05:59 +02:00
tools buildsystem: fix build errors for x86 on OSX 2014-11-04 11:00:29 +01:00
usr.bin ARM: can build with llvm, switch to EABI 2014-12-12 13:04:56 +01:00
usr.sbin Import NetBSD shell environment files 2014-11-10 16:48:56 +01:00
.gitignore gitignore: ignore some more generated files 2012-12-06 13:29:20 +00:00
.gitreview build:update 'git review' config to match gerrit.minix3.org 2014-07-28 17:05:15 +02:00
LICENSE Fix parameter parsing in cut 2010-01-21 10:16:05 +00:00
Makefile INIT died problem / build system robustness 2014-08-28 08:52:50 +02:00
Makefile.inc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
build.sh Importing netbsd clang -- pristine 2014-07-28 17:05:57 +02:00