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

On 6/27/06, Paul Fulghum <paulkf@microgate.com> wrote:
> No one has leaped in here with any wisdom, but the people
> who wrote that code may be dead or otherwise employed.
>
> If you have knowledge of how those bits work,
> I encourage to you dig through the code and determine
> what needs to be done. It is certainly an area that can
> use more review.
>
> I did see a comment that tty_mutex protects the creation
> and destruction of tty structures, so I assume the coverage
> of tty_old_pgrp has some relation to that. Unfortunately,
> I have seen other locks get borrowed for multiple purposes.

I'm having trouble divining the use of tty_mutex. In most cases it is
protecting pgrp, tty_old_pgrp and tty fields in signal_struct.
sys_setsid(), disassociate_ctty(), daemonize(), tty::release_dev(),
tty_open() use it this way. But it is also used to protect
tty::init_dev() which makes no use of the signal_struct fields. Then
there is the use in vt::con_close() which also does not involved the
signal_struct fields.

Why does this need to be protected? exit.c
	mutex_lock(&tty_mutex);
	current->signal->tty = NULL;
	mutex_unlock(&tty_mutex);

After looking at all of this for a couple of hours it looks to me like
tty_mutex could be removed if ref counts were used to control when the
tty_struct gets destroyed. I think the problem being addressed is
dangling pointers in signal_struct::tty when a tty is being closed.
Ref counts would delay the freeing of tty_struct until all the
references were released.

-- 
Jon Smirl
jonsmirl@gmail.com

  reply	other threads:[~2006-06-28  3:29 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 [this message]
2006-06-28 10:24     ` Alan Cox
2006-06-28 17:36       ` Jon Smirl
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=9e4733910606272029r32255d27we6e8b34a4c2e569@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®