From owner-freebsd-bugs Thu Apr 12 1:10:24 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id AB23437B61D for ; Thu, 12 Apr 2001 01:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f3C8A1S41333; Thu, 12 Apr 2001 01:10:01 -0700 (PDT) (envelope-from gnats) Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id E4ACF37B42C for ; Thu, 12 Apr 2001 01:05:17 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 29D413E29 for ; Thu, 12 Apr 2001 01:05:14 -0700 (PDT) Received: (from dima@localhost) by hornet.unixfreak.org (8.11.1/8.11.1) id f3C85EC90485; Thu, 12 Apr 2001 01:05:14 -0700 (PDT) (envelope-from dima) Message-Id: <200104120805.f3C85EC90485@hornet.unixfreak.org> Date: Thu, 12 Apr 2001 01:05:14 -0700 (PDT) From: dd@freebsd.org Reply-To: dd@freebsd.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/26508: [PATCH] syscons panic in userconfig mode Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26508 >Category: kern >Synopsis: [PATCH] syscons panic in userconfig mode >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 12 01:10:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Dima Dorfman >Release: FreeBSD 5.0-20010407-CURRENT i386 >Organization: Private >Environment: System: FreeBSD spike.unixfreak.org 5.0-20010407-CURRENT FreeBSD 5.0-20010407-CURRENT #39: Sun Apr 8 22:44:22 PDT 2001 dima@spike.unixfreak.org:/c/home/dima/w/f/src/sys/compile/SPIKE i386 >Description: 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. >How-To-Repeat: 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. >Fix: The patch 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). 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; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message