NetBSD Problem Report #8690

Received: (qmail 22260 invoked from network); 26 Oct 1999 19:54:27 -0000
Message-Id: <199910261953.VAA07900@vader.runit.sintef.no>
Date: Tue, 26 Oct 1999 21:53:55 +0200 (MEST)
From: he@nordu.net (Havard Eidnes)
Reply-To: he@nordu.net (Havard Eidnes)
To: gnats-bugs@gnats.netbsd.org
Subject: console open may cause crash if kernel incorrectly configured
X-Send-Pr-Version: 3.95

>Number:         8690
>Category:       kern
>Synopsis:       console open may cause crash if kernel incorrectly configured
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 26 12:57:00 +0000 1999
>Closed-Date:    Tue Oct 26 21:16:55 +0000 1999
>Last-Modified:  Tue Oct 26 21:17:42 +0000 1999
>Originator:     Havard Eidnes
>Release:        netbsd-1-4 release branch, 20 Oct 1999
>Organization:
	NORDUnet AS
>Environment:
NetBSD server.nordu.net 1.4.1 NetBSD 1.4.1 (SERVER) #6: Mon Oct 25 19:31:11 MEST 1999     he@vever.runit.sintef.no:/usr/src/sys/arch/i386/compile/SERVER i386

>Description:
	If you configure wscons to not have support for the display
hardware actually installed in the machine, the first attempt at
opening the console (typically done by init) will cause a kernel page
fault trap instead of producing a sensible error message.

The crash will happen due to a call into nowhere-land in cnopen(), as
shown in this DDB session:

[ netbsd ELF sumbol table not valid ]
[ preserving 1442216 bytes of netbsd a.out symbol table ]
Stopped in at _Debugger+0x4: leave
db>break 0xf01e0b65
db>continue
<NetBSD banner and device probing.>
...
...
de0: enabling BNC port.
Breakpoint in init at _cnopen+0x45:	movl	_cdevsw(,%eax,8),%eax
db>show reg
es		0x10
ds		0x10
edi		0xf4a2d3c0	_end+0x47c32b0
esi		0x1f
ebp		0xf4a3fdac	_end+0x47d5c9c
ebx		0xffffffff	_ATPD+0xfff
edx		0x1
ecx		0
eax		0x4ffb
eip		0xf01e0b65	_cnopen+0x45
cs		0x8
eflags		0x206
esp		0xf4a3fd98	_end+0x47d5c88
ss		0xf0260010	_tcp_debug+0x4df0
_cnopen+0x45:	movl	_cdevsw(,%eax,8),%eax
db>step
Breakpoint in init at 
db>show reg
es		0x10
ds		0x10
edi		0xf4a2d3c0	_end+0x47c32b0
esi		0x1f
ebp		0xf4a3fdac	_end+0x47d5c9c
ebx		0xffffffff	_ATPD+0xfff
edx		0x1
ecx		0
eax		0x9b009a
eip		0xf01e0b65	_cnopen+0x45
cs		0x8
eflags		0x206
esp		0xf4a3fd98	_end+0x47d5c88
ss		0xf0260010	_tcp_debug+0x4df0
_cnopen+0x4c:	call	*%eax
db>step
Stopped in init at 0x9b009a:uvm_fault(0xf4a330b0,0xefc02000, 0, 1) -> 1
	kernel: page fault trap, code=0
Stopped in init at _db_disasm+0x1b: movl _PTmap(%eax),%eax
db>

The eax=0x4ffb in the first "show reg" output is the computed major
device number, and "of course" calling through 0x9b009a doesn't work
particularly well.


>How-To-Repeat:
	Have machine with ISA vga card.

	Think that you have a PCI vga card, and as a result, be a
little too overzealous in removing device drivers you "don't need", in
particular remove or comment out these two

vga0            at isa?
wsdisplay*      at vga? console ?

Boot kernel.  Watch fireworks.  Scratch head (that's what I did,
anyway ;-)

>Fix:
	The obvious fix is "don't do that, then".

	However, I think the code could or should be improved to give
an easier-to-understand error message if no wsdisplay* device is
found and wsconsole is configured.
>Release-Note:
>Audit-Trail:

From: Matthias Drochner <drochner@zel459.zel.kfa-juelich.de>
To: he@nordu.net (Havard Eidnes)
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/8690: console open may cause crash if kernel incorrectly 
 configured
Date: Tue, 26 Oct 1999 22:48:51 +0200

 he@nordu.net said:
 > The crash will happen due to a call into nowhere-land in cnopen()

 You might want to pull up rev. 1.33 of sys/dev/cons.c.

 best regards
 Matthias



From: Havard.Eidnes@runit.sintef.no
To: M.Drochner@fz-juelich.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/8690: console open may cause crash if kernel incorrectly 
 configured
Date: Tue, 26 Oct 1999 22:55:15 +0200

 > he@nordu.net said:
 > > The crash will happen due to a call into nowhere-land in cnopen()
 >
 > You might want to pull up rev. 1.33 of sys/dev/cons.c.

 Ah, yes, that looks right.  I'll submit a pull-up request and
 subsequently do it.

 Thanks,

 - H=E5vard
State-Changed-From-To: open->closed 
State-Changed-By: he 
State-Changed-When: Tue Oct 26 14:16:55 PDT 1999 
State-Changed-Why:  
Problem fixed by pulling up 1.33 of /sys/dev/cons.c. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.