Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jan 2008 13:49:22 +0100
From:      Ed Schouten <ed@fxq.nl>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: cnclose() doesn't actually call TTY's close routines
Message-ID:  <20080121124922.GS67081@hoeg.nl>
In-Reply-To: <20080121115227.GR67081@hoeg.nl>
References:  <20080121115227.GR67081@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

--XMM+kVNHGkMezEqK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Ed Schouten <ed@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,
--=20
 Ed Schouten <ed@fxq.nl>
 WWW: http://g-rave.nl/

--XMM+kVNHGkMezEqK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iEYEARECAAYFAkeUlNIACgkQ52SDGA2eCwU2PwCeKutXGJowVOoybSWl9VzoFpwm
WKIAn1g9ifk8pfyy4CFjpqlLbDs4f58i
=YVHG
-----END PGP SIGNATURE-----

--XMM+kVNHGkMezEqK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080121124922.GS67081>