Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2007 12:47:24 +0100
From:      Ed Schouten <ed@fxq.nl>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        stable@FreeBSD.org, current@FreeBSD.org
Subject:   Re: Attention 7.x and 8.x ptmx/pts users (read if you set kern.pts.enable=1)
Message-ID:  <20071204114724.GL72574@hoeg.nl>
In-Reply-To: <20071204111050.W30376@fledge.watson.org>
References:  <20071203225800.S30376@fledge.watson.org> <20071204102328.GK72574@hoeg.nl> <20071204111050.W30376@fledge.watson.org>

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

[-- Attachment #1 --]
* Robert Watson <rwatson@FreeBSD.org> wrote:
> Yes.  There's also another known issue, likely not corrected by this patch, 
> in which closing the pty before the pts fails to properly wake up processes 
> hung off the pts and inform them of its impending doom, resulting in the 
> pty/pts pair never being garbage-collected.  I've not tracked this down 
> yet, but you can reproduce it by running screen(1) and then "killing" a 
> screen.  screen(1) closes the pty and relies on the pty/pts mechanism to do 
> the rest, which doesn't.

Indeed. I also noticed this bug. Simply killing sshd also reproduces
this. The leak is caused by the obvious if-statement inside
pty_maybecleanup(). This is because SESSRELE() is called after sshd
closes the pty, if I can remember correctly.

This also causes the dreaded `jail leak', because device nodes still
exist that have been created with make_dev_cred(), so the ucred is
still referenced.

I guess the problem is that we can only call pty_maybecleanup() when
ptsclose() is called and not when the real use-count of the tty has
reached zero.

Yours,
-- 
 Ed Schouten <ed@fxq.nl>
 WWW: http://g-rave.nl/

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHVT5M52SDGA2eCwURAuVmAJ4+IKFmjDtwN6FE3rpxbfX5Vrz5DwCeLMyJ
Bwo1kNdbwesN2pzbYGpAUXc=
=FNK+
-----END PGP SIGNATURE-----

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