• E
    tty: introduce no_tty and use it in selinux · 98a27ba4
    Eric W. Biederman 提交于
    While researching the tty layer pid leaks I found a weird case in selinux when
    we drop a controlling tty because of inadequate permissions we don't do the
    normal hangup processing.  Which is a problem if it happens the session leader
    has exec'd something that can no longer access the tty.
    
    We already have code in the kernel to handle this case in the form of the
    TIOCNOTTY ioctl.  So this patch factors out a helper function that is the
    essence of that ioctl and calls it from the selinux code.
    
    This removes the inconsistency in handling dropping of a controlling tty and
    who knows it might even make some part of user space happy because it received
    a SIGHUP it was expecting.
    
    In addition since this removes the last user of proc_set_tty outside of
    tty_io.c proc_set_tty is made static and removed from tty.h
    Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
    Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
    Cc: James Morris <jmorris@namei.org>
    Cc: Stephen Smalley <sds@tycho.nsa.gov>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    98a27ba4
tty_io.c 99.5 KB