Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 1995 07:21:50 -0700
From:      petri@ibr.cs.tu-bs.de (stefan Petri)
To:        freebsd-bugs
Subject:   kern/544: pci_bus_config() does not init parent pointers in device list + fix
Message-ID:  <199506231421.HAA07059@freefall.cdrom.com>
In-Reply-To: Your message of Tue, 20 Jun 1995 22:06:09 %2B0200 <199506202006.WAA00698@jupiter.ibr.cs.tu-bs.de>

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

>Number:         544
>Category:       kern
>Synopsis:       pci_bus_config() does not init parent pointers in device list
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 23 07:21:49 1995
>Originator:     Stefan Petri
>Organization:
TU Braunschweig, Inst. f. Betriebssysteme u. Rechnerverbund
>Release:        FreeBSD 2.0.950412-SNAP i386
>Environment:

	486 with PCI bus,
	FreeBSD kernel with ``option DIAGNOSTIC'' enabled

>Description:

	/usr/src/sys/pci.c::pci_bus_config() does not initialize the
	parent pointers in the devconf list; there is also a comment
	that this should be added. In the GENERIC kernel, this seems not
	to be a real problem, because the freshly malloced devconf
	structure almost always is pre-set with 0 resp. NULL.
	However, if ``option DIAGNOSTIC'' is enabled, malloc() will
	fill all memory areas with pattern 0xdeadbeef. If lsdev(8) is
	invoked on such a kernel, it will result in a panic when
	trying to get the descriptions for the PCI bus via sysctl(3).

>How-To-Repeat:

	short version: invoke lsdev(8) on a kernel compiled with DIAGNOSTIC,
	on a machine with PCI bus

	long version: instrument lsdev and /sys/kern/kern_devconf.c with
	printf()s, and then:

jupiter:/tmp 2 # sync;sync;sync;./lsdev+printf
Device     State           Description
---------- --------------- --------------------------------------------------
cpu0       Busy            i486 DX4
[..]
npx0       Busy            Floating-point unit
> sysctl( {6, 11, 12}, 3, dc, &size, 0, 0)
jupiter /kernel: make_devconf(name=chip unit=0 number=12 parent=0xdeadbeef
                                   ^^^^                         ^^^^^^^^^^
jupiter /kernel: Fatal trap 12: page fault while in kernel mode
[..]




>Fix:
	
simply disabling DIAGNOSTIC would be the equivalent to wearing my
Joo Janta 200 Super-Chromatic Peril Sensitive Sunglasses, so I
suggest the following:

--- pci.c-2.0.950412-SNAP	Thu Mar 23 07:14:44 1995
+++ pci.c	Tue Jun 20 21:27:04 1995
@@ -551,7 +551,10 @@
 		pdcp -> pdc_kdc.kdc_name = dvp->pd_name;
 		pdcp -> pdc_kdc.kdc_unit = unit;
 
+		pdcp -> pdc_kdc.kdc_parent = NULL;
+
 		pdcp -> pdc_kdc.kdc_md.mddc_devtype = MDDT_PCI;
+		pdcp -> pdc_kdc.kdc_md.mddc_flags = 0;
 
 		pdcp -> pdc_kdc.kdc_externalize = pci_externalize;
 		pdcp -> pdc_kdc.kdc_internalize = pci_internalize;
>Audit-Trail:
>Unformatted:





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