freebsd-skq/sys/fs
Ed Schouten 8dc9b4cf04 Let access overriding to TTYs depend on the cdev_priv, not the vnode.
Basically this commit changes two things, which improves access to TTYs
in exceptional conditions. Basically the problem was that when you ran
jexec(8) to attach to a jail, you couldn't use /dev/tty (well, also the
node of the actual TTY, e.g. /dev/pts/X). This is very inconvenient if
you want to attach to screens quickly, use ssh(1), etc.

The fixes:

- Cache the cdev_priv of the controlling TTY in struct session. Change
  devfs_access() to compare against the cdev_priv instead of the vnode.
  This allows you to bypass UNIX permissions, even across different
  mounts of devfs.

- Extend devfs_prison_check() to unconditionally expose the device node
  of the controlling TTY, even if normal prison nesting rules normally
  don't allow this. This actually allows you to interact with this
  device node.

To be honest, I'm not really happy with this solution. We now have to
store three pointers to a controlling TTY (s_ttyp, s_ttyvp, s_ttydp).
In an ideal world, we should just get rid of the latter two and only use
s_ttyp, but this makes certian pieces of code very impractical (e.g.
devfs, kern_exit.c).

Reported by:	Many people
2009-12-19 18:42:12 +00:00
..
cd9660
coda
deadfs
devfs Let access overriding to TTYs depend on the cdev_priv, not the vnode. 2009-12-19 18:42:12 +00:00
fdescfs
fifofs
hpfs
msdosfs
nfs Remove unneeded ifdefs. 2009-12-03 18:03:42 +00:00
nfsclient Remove unneeded ifdefs. 2009-12-03 18:03:42 +00:00
nfsserver Allow using IPv6 in nfsrvd_sentcache() callback. 2009-12-08 23:43:50 +00:00
ntfs Fix ntfs such that it understand media with a non-512-bytes sector size: 2009-12-07 15:15:08 +00:00
nullfs
nwfs
portalfs Don't use ap->a_td->td_ucred when we were passed ap->a_cred. 2009-12-02 18:09:22 +00:00
procfs
pseudofs
smbfs
tmpfs
udf
unionfs