Re: cnclose() doesn't actually call TTY's close routines

From: Ed Schouten <ed_at_fxq.nl>
Date: Mon, 21 Jan 2008 13:49:22 +0100
* Ed Schouten <ed_at_fxq.nl> wrote:
> It isn't a real problem, because nobody runs TIOCSCTTY on /dev/console
> and pstat(8) only displays some info in that structure, but it should be
> fixed I guess. I'll take a look at this one of these days, but it will
> probably be quite hard for me, because I'm not really familiar with the
> VFS's design.

Ah, I guess I figured it out. It doesn't happen on systems where moused
isn't running. moused opens /dev/consolectl on startup and leaves it
open during its lifetime. When cnclose() calls vn_close(), it won't run
the TTY's close routine because /dev/consolectl is used multiple times.

This means that when a TTY is opened by multiple processes (quite
common), the session will be unset when all users are gone, not when
session itself is being released. This could cause scary things, for
example in ttymodem() when a SIGHUP is sent to the session leader.

This could be fixed by adding a ttysessrel(), which basically performs a
ttyrel(), but also unsets the t_session. I'll take a look at this next
month, when I'll be working on FreeBSD full-time. :-)

Yours,
-- 
 Ed Schouten <ed_at_fxq.nl>
 WWW: http://g-rave.nl/

Received on Mon Jan 21 2008 - 11:49:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:26 UTC