Re: tty_mutex and tty_old_pgrp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This selinux code is checking to see if the current process still has
access rights to it's controlling tty, right? If it doesn't tty and
tty_old_pgrp are nulled out. Does this need locking? Can you
disassociate a task like this by nulling out tty, what about the child
tasks in the session if it is the leader?

security/selinux/hooks.c

/* Derived from fs/exec.c:flush_old_files. */
static inline void flush_unauthorized_files(struct files_struct * files)
{
       struct avc_audit_data ad;
       struct file *file, *devnull = NULL;
       struct tty_struct *tty = current->signal->tty;
       struct fdtable *fdt;
       long j = -1;

       if (tty) {
               file_list_lock();
               file = list_entry(tty->tty_files.next, typeof(*file),
f_u.fu_list);
               if (file) {
                       /* Revalidate access to controlling tty.
                          Use inode_has_perm on the tty inode directly rather
                          than using file_has_perm, as this particular open
                          file may belong to another process and we are only
                          interested in the inode-based check here. */
                       struct inode *inode = file->f_dentry->d_inode;
                       if (inode_has_perm(current, inode,
                                          FILE__READ | FILE__WRITE, NULL)) {
                               /* Reset controlling tty. */
                               current->signal->tty = NULL;
                               current->signal->tty_old_pgrp = 0;
                       }
               }
               file_list_unlock();
       }



--
Jon Smirl
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux