public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Jon Smirl <jonsmirl@gmail.com>
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 11:24:00 +0100	[thread overview]
Message-ID: <1151490240.15166.5.camel@localhost.localdomain> (raw)
In-Reply-To: <9e4733910606272029r32255d27we6e8b34a4c2e569@mail.gmail.com>

Ar Maw, 2006-06-27 am 23:29 -0400, ysgrifennodd Jon Smirl:
> Why does this need to be protected? exit.c
> 	mutex_lock(&tty_mutex);
> 	current->signal->tty = NULL;
> 	mutex_unlock(&tty_mutex);

It races against things like a third party haungup of the controlling
tty session if the lock is not held.

> 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. 

You would still want memory barriers and to audit the time things took
effect as there is a fairly defined ordering involved here. Fully
refcounting ttys would not be a bad thing but would require some driver
work because the driver level objects hung off a tty are often not
dynamically allocated and are not themselves refcounted so would get
corrupted if the tty object was freed and a new one allocated and opened
in the meantime.

Alan


  reply	other threads:[~2006-06-28 10:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 22:38 tty_mutex and tty_old_pgrp Jon Smirl
2006-06-27 22:56 ` Paul Fulghum
2006-06-28  3:29   ` Jon Smirl
2006-06-28 10:24     ` Alan Cox [this message]
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=1151490240.15166.5.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=jonsmirl@gmail.com \
    --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