summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-12-19 18:42:12 +0000
committered <ed@FreeBSD.org>2009-12-19 18:42:12 +0000
commit449c6ac843fc9f9da250e1d981af004d11807bfd (patch)
treed2f0cd5bf3bd0da66eebbb1c4ce6d81041cf26cf /sys/kern/kern_proc.c
parent74382eba8c8620e12c65837209761348b2265ba9 (diff)
downloadFreeBSD-src-449c6ac843fc9f9da250e1d981af004d11807bfd.zip
FreeBSD-src-449c6ac843fc9f9da250e1d981af004d11807bfd.tar.gz
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
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index f931245..86eb6fc 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -358,6 +358,7 @@ enterpgrp(p, pgid, pgrp, sess)
sess->s_sid = p->p_pid;
refcount_init(&sess->s_count, 1);
sess->s_ttyvp = NULL;
+ sess->s_ttydp = NULL;
sess->s_ttyp = NULL;
bcopy(p->p_session->s_login, sess->s_login,
sizeof(sess->s_login));
OpenPOWER on IntegriCloud