mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Paul Fulghum" <paulkf@microgate.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: tty_mutex and tty_old_pgrp
Date: Wed, 28 Jun 2006 13:36:43 -0400	[thread overview]
Message-ID: <9e4733910606281036k53956aaev3d323fbb7a2cb7a9@mail.gmail.com> (raw)
In-Reply-To: <1151490240.15166.5.camel@localhost.localdomain>

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
jonsmirl@gmail.com

  reply	other threads:[~2006-06-28 17:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 22:38 Jon Smirl
2006-06-27 22:56 ` Paul Fulghum
2006-06-28  3:29   ` Jon Smirl
2006-06-28 10:24     ` Alan Cox
2006-06-28 17:36       ` Jon Smirl [this message]
2006-06-28 18:04         ` Alan Cox
2006-06-28 18:13           ` Jon Smirl
2006-06-29  5:41             ` Jon Smirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e4733910606281036k53956aaev3d323fbb7a2cb7a9@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulkf@microgate.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®