lkml.org 
[lkml]   [2006]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: tty_mutex and tty_old_pgrp
From
Date
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

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

\
 
 \ /
  Last update: 2006-06-28 12:10    [W:0.053 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site