From owner-freebsd-current@FreeBSD.ORG Mon Jan 21 11:52:28 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCC5E16A418 for ; Mon, 21 Jan 2008 11:52:28 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211]) by mx1.freebsd.org (Postfix) with ESMTP id A6B3613C478 for ; Mon, 21 Jan 2008 11:52:28 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id F02491CD79; Mon, 21 Jan 2008 12:52:27 +0100 (CET) Date: Mon, 21 Jan 2008 12:52:27 +0100 From: Ed Schouten To: FreeBSD Current Message-ID: <20080121115227.GR67081@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v4cNTr+tRGSs1txX" Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) Subject: cnclose() doesn't actually call TTY's close routines X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2008 11:52:28 -0000 --v4cNTr+tRGSs1txX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello everyone, This morning I discovered a very strange bug this morning on my FreeBSD box and I think even RELENG_6 has this issue. Here's what you do: - Make sure you've got a kernel with all the debugging options enabled, so free() writes all 0xdeadc0de's in memory. - Boot your box and make sure it has been running for a couple of minutes (fsck is already finished, etc). - Now run `pstat -t'. If you look at consolectl's entry (the boot console device of syscons), you'll (hopefully) see that its session ID is -559038242, which is 0xdeadc0de. I already tried to track it down and I think I understand where things go wrong. In /sys/kern/tty_cons.c there are wrappers around individual cdevsw's to multiplex console output to multiple terminal devices. In the cnclose() routines, it calls vn_close() on all the terminal devices in the list, which makes sense. But for some reason, vn_close() eventually doesn't call scclose(). 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. --=20 Ed Schouten WWW: http://g-rave.nl/ --v4cNTr+tRGSs1txX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAkeUh3sACgkQ52SDGA2eCwVJ0gCeJBE0qgO7LiLsbR6Cg2TJeAMu dncAnjagb+dtp11Ur7DPoSuUxfhVtrfq =vH3r -----END PGP SIGNATURE----- --v4cNTr+tRGSs1txX--