Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Apr 2001 01:05:14 -0700 (PDT)
From:      dd@freebsd.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/26508: [PATCH] syscons panic in userconfig mode
Message-ID:  <200104120805.f3C85EC90485@hornet.unixfreak.org>

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

>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




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