From owner-freebsd-stable Sat Apr 7 14:25:47 2001 Delivered-To: freebsd-stable@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 8BB8037B424; Sat, 7 Apr 2001 14:25:42 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 2418A3E09; Sat, 7 Apr 2001 14:25:42 -0700 (PDT) To: current@freebsd.org Cc: stable@freebsd.org Subject: syscons panic in userconfig mode (with patch) Date: Sat, 07 Apr 2001 14:25:42 -0700 From: Dima Dorfman Message-Id: <20010407212542.2418A3E09@bazooka.unixfreak.org> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [ cc'd to -stable since that's affected, too ] Attempting to switch VTYs in userconfig mode will lead to a null dereference in syscons. I saw some messages about this on -current, -stable, or -bugs recently, but I can't find them now. This is pretty easy to reproduce: simply boot the kernel with the -c flag (userconfig), and press ALT+F2 (i386). As far as I can tell, this isn't a new bug. The patch is also pretty trivial. It just changes the VIRTUAL_TTY macro not to blindly assume sc->dev[x] is a valid pointer. It is safe to have it "return" NULL because any code that uses it must (and does) already check for that condition since si_tty may also be NULL in some cases (or at least that's the way I understand it). Could someone please look it over and, if it's okay, commit it? Thanks, Dima Dorfman dima@unixfreak.org Index: syscons.c =================================================================== RCS file: /st/src/FreeBSD/src/sys/dev/syscons/syscons.c,v retrieving revision 1.355 diff -u -r1.355 syscons.c --- syscons.c 2001/03/26 12:40:39 1.355 +++ syscons.c 2001/04/07 21:02:31 @@ -122,7 +122,8 @@ #define SC_CONSOLECTL 255 -#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty) +#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x)) != NULL ? \ + SC_DEV((sc), (x))->si_tty : NULL) static int debugger; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message