NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56935: NetBSD HEAD/202207161950Z i386 kernel misidentifies CPU and panics when multiboot-ed



>Number:         56935
>Category:       kern
>Synopsis:       NetBSD HEAD/202207161950Z i386 kernel misidentifies CPU and panics when multiboot-ed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 19 16:25:00 +0000 2022
>Originator:     Ivan Shmakov <ivan%siamics.net@localhost>
>Release:        NetBSD 9.99.98 202207161950Z
>Organization:
>Environment:
Architecture: i386
Machine: i386
>Description:

	Attempting to boot NetBSD kernel as of a recent HEAD
	snapshot [1] via Syslinux mboot.c32 module under Qemu 3.1
	from Debian 10 (oldstable) results in a panic, apparently
	due to the CPU being misidentified as 80386-class:

[1] http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202207161950Z/i386/binary/sets/kern-GENERIC.tgz

[   1.0000030] ACPI: 1 ACPI AML tables successfully acquired and loaded
[   1.0000030] ioapic0 at mainbus0 apid 0
[   1.0000030] cpu0 at mainbus0 apid 0
[   1.0000030] cpu0: Intel 386-class
[   1.0000030] cpu0: node 0, package 0, core 0, smt 0
[   1.0000030] panic: NetBSD requires an 80486DX or later processor
[   1.0000030] cpu0: Begin traceback...
[   1.0000030] vpanic(c13124e8,c18e4d40,c18e4d58,c049bd9b,c13124e8,c1703f60,31,0,0,0) at netbsd:vpanic+0x196
[   1.0000030] panic(c13124e8,c1703f60,31,0,0,0,c164a0c0,c18e4d98,c048888c,c15fff80) at netbsd:panic+0x18
[   1.0000030] cpu_identify(c15fff80,1,2,c13d722b,c1ac8cec,c1a89224,c1a89600,c15fff80,c13d722b,c1ac8d34) at netbsd:cpu_identify+0x259
[   1.0000030] cpu_attach(c1a89200,c1a89600,c18e4e28,c1a89200,c18e4e24,c18e4e28,c1a89200,c1a89600,c18e4dec,c1a89200) at netbsd:cpu_attach+0x249

	(Full transcript MIMEd separately.)

	This looks like a regression, as NetBSD 9 kernels Iâ??ve used
	so far (9.1, 9.2, recent snapshot [2]) booted correctly in
	such a configuration.

[2] http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/202207180150Z/source/sets/syssrc.tgz

	A cursory glance at the diffs between the respective revisions
	of usr/src/sys/arch/x86/x86/identcpu.c and cpu.c, as well as
	usr/src/sys/arch/x86/include/cpufunc.h didnâ??t reveal anything
	that mightâ??ve been responsible.  However, there seem to be
	much new code in usr/src/sys/arch/i386/i386/locore.S (where
	cputype and cpuid_level are initialized) related to Multiboot,
	so that seems like a good starting point to look for the cause.

	(JFTR, I donâ??t have a NetBSD system at hand right now, so
	I cannot try booting with NetBSDâ??s own /boot to check whether
	the issue is specific to mboot.c32 /or/ Qemu.  Though unless
	someone beats me to it, Iâ??ll probably try that within a week
	or two.)

>How-To-Repeat:

	Iâ??m going to use GNU Mtools, Syslinux and Qemu from Debian 10,
	but the same should be available from pkgsrc.  The truncate(1)
	command that Iâ??ll use to create a sparse file of the given
	size doesnâ??t seem to be ported to NetBSD yet, though.  The {,}
	and ${var^^} expansions below are specific to Bash.

	We create a sparse â??hard disk imageâ?? file; create an MBR
	partition there; initialize Ecma 107 filesystem; copy the
	two kernels to test there; put Syslinux MBR code into
	the first 440 bytes of the image; install Syslinux core;
	copy a selection of Syslinux modules; copy Syslinux
	configuration; boot Qemu twice, once for NetBSD HEAD kernel
	(misnamed NetBSD 10 below), once for NetBSD 9 one.

$ truncate -s48M -- /tmp/AQItFzcC.image 
$ export MTOOLSRC=/tmp/ESSQAoIn.rc 
$ printf %s\\n "drive y: file=\"/tmp/AQItFzcC.image\" partition=1" \
      > "$MTOOLSRC" 
$ mpartition -b$((2 * 2048)) -l$((45 * 2048)) -c -- y: 
$ mformat -- y: 
$ tar -zxf- -- ./netbsd \
      < netbsd-9/202207180150Z/i386/binary/sets/kern-GENERIC.tgz 
$ mcopy -m -- netbsd y:/NBSD9SN 
$ tar -zxf- -- ./netbsd \
      < HEAD/202207161950Z/i386/binary/sets/kern-GENERIC.tgz 
$ mcopy -m -- netbsd y:/NBSD10SN 
$ rm -- netbsd 
$ dd count=1 bs=440 conv=notrunc of=/tmp/AQItFzcC.image \
      < /usr/lib/syslinux/mbr/mbr.bin 
$ mmd -- y:/SYSLINUX 
$ syslinux --offset=$((2 * 0x100000)) -d SYSLINUX --install \
      -- /tmp/AQItFzcC.image 
$ (for f in /usr/lib/syslinux/modules/bios/\
{chain,cmd,libcom32,libutil,mboot}.c32 ; do \
       b=${f##*/} ; mcopy -m -- "$f" y:/SYSLINUX/"${b^^}" ; \
   done) 
$ mcopy -m -- 200.netbsd.conf y:/SYSLINUX/SYSLINUX.CFG 
$ mdir -/a -- y: 
(Output MIMEd separately.)
$ qemu-system-x86_64 -m 64 -machine type=pc-i440fx-2.1,accel=kvm \
      -display none -chardev stdio,mux=on,id=stdio \
      -mon chardev=stdio -serial chardev:stdio \
      -drive file=/tmp/AQItFzcC.image,if=ide,format=raw 
(Transcript MIMEd separately.)
$ qemu-system-x86_64 -m 64 -machine type=pc-i440fx-2.1,accel=kvm \
      -display none -chardev stdio,mux=on,id=stdio \
      -mon chardev=stdio -serial chardev:stdio \
      -drive file=/tmp/AQItFzcC.image,if=ide,format=raw 
(Transcript MIMEd separately.)
$ 

>Fix:


-- 
FSF associate member #7257  http://am-1.org/~ivan/

--ifacw6d3hli5glln
Content-Type: text/plain; charset=us-ascii
Content-Description: NetBSD 9.99.98/i386 202207161950Z kernel boot transcript 
Content-Disposition: attachment; filename="200.netbsd-10.text"


SYSLINUX 6.04 20190226 Copyright (C) 1994-2015 H. Peter Anvin et al
No DEFAULT or UI configuration directive found!
boot: netbsd-10-snapshot console=com 
Loading /NBSD10SN... ok
[   1.0000000] multiboot: Information structure flags: 0x00000265
[   1.0000000] multiboot: Boot loader: SYSLINUX 6.04 20190226
[   1.0000000] multiboot: Command line: /NBSD10SN console=com
[   1.0000000] multiboot: 639 KB lower memory, 64384 KB upper memory
[   1.0000000] multiboot: Symbol table at 0xc170b000, length 925296 bytes
[   1.0000000] multiboot: String table at 0xc17ece70, length 996931 bytes
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[   1.0000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[   1.0000000]     2018, 2019, 2020, 2021, 2022
[   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.

[   1.0000000] NetBSD 9.99.98 (GENERIC) #0: Sat Jul 16 19:46:50 UTC 2022
[   1.0000000]  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC
[   1.0000000] total memory = 65020 KB
[   1.0000000] avail memory = 39564 KB
[   1.0000030] mainbus0 (root)
[   1.0000030] ACPI: RSDP 0x00000000000F58D0 000014 (v00 BOCHS )
[   1.0000030] ACPI: RSDT 0x0000000003FE1355 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[   1.0000030] ACPI: FACP 0x0000000003FE1231 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[   1.0000030] ACPI: DSDT 0x0000000003FE0040 0011F1 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[   1.0000030] ACPI: FACS 0x0000000003FE0000 000040
[   1.0000030] ACPI: APIC 0x0000000003FE12A5 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[   1.0000030] ACPI: HPET 0x0000000003FE131D 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[   1.0000030] ACPI: 1 ACPI AML tables successfully acquired and loaded
[   1.0000030] ioapic0 at mainbus0 apid 0
[   1.0000030] cpu0 at mainbus0 apid 0
[   1.0000030] cpu0: Intel 386-class
[   1.0000030] cpu0: node 0, package 0, core 0, smt 0
[   1.0000030] panic: NetBSD requires an 80486DX or later processor
[   1.0000030] cpu0: Begin traceback...
[   1.0000030] vpanic(c13124e8,c18e4d40,c18e4d58,c049bd9b,c13124e8,c1703f60,31,0,0,0) at netbsd:vpanic+0x196
[   1.0000030] panic(c13124e8,c1703f60,31,0,0,0,c164a0c0,c18e4d98,c048888c,c15fff80) at netbsd:panic+0x18
[   1.0000030] cpu_identify(c15fff80,1,2,c13d722b,c1ac8cec,c1a89224,c1a89600,c15fff80,c13d722b,c1ac8d34) at netbsd:cpu_identify+0x259
[   1.0000030] cpu_attach(c1a89200,c1a89600,c18e4e28,c1a89200,c18e4e24,c18e4e28,c1a89200,c1a89600,c18e4dec,c1a89200) at netbsd:cpu_attach+0x249
[   1.0000030] config_attach_internal(c04b72c1,c18e4dec,0,c18e4e10,c04a10e3,c1652dc0,c0d8322a,c12b4b5a,c18e4e24,0) at netbsd:config_attach_internal+0x198
[   1.0000030] config_found(c1a89200,c18e4e28,c04b72c1,c18e4e38,0,0,0,1,c118f61c,1) at netbsd:config_found+0xab
[   1.0000030] mpacpi_config_cpu(c569c2d1,c1a89200,c1a89200,0,0,c18e4e8c,c04b7ccb,c04b7179,c1a89200,0) at netbsd:mpacpi_config_cpu+0xd0
[   1.0000030] acpi_madt_walk(c04b7179,c1a89200,0,c1a89200,c18e4ee0,c012ba79,c1a89200,c18e4ea4,c13fd721,c1ad4c5c) at netbsd:acpi_madt_walk+0x2f
[   1.0000030] mpacpi_scan_apics(c1a89200,c18e4ea4,c13fd721,c1ad4c5c,0,c1ac8d58,c18e4ee0,c0d81745,c13d722b,c1ac8d58) at netbsd:mpacpi_scan_apics+0x76
[   1.0000030] mainbus_attach(0,c1a89200,0,0,0,0,0,c1a89200,c16422a8,0) at netbsd:mainbus_attach+0xba
[   1.0000030] config_attach_internal(0,c18e4f30,0,1100000,0,0,0,0,0,0) at netbsd:config_attach_internal+0x198
[   1.0000030] config_rootfound(c12b3109,0,c18e4fb0,c0f6867f,3,0,64,0,0,0) at netbsd:config_rootfound+0x7b
[   1.0000030] cpu_configure(3,0,64,0,0,0,0,0,2a54000,0) at netbsd:cpu_configure+0x3e
[   1.0000030] main(0,0,0,0,0,0,0,0,0,0) at netbsd:main+0x33f
[   1.0000030] cpu0: End traceback...
[   1.0000030] fatal breakpoint trap in supervisor mode
[   1.0000030] trap type 1 code 0 eip 0xc011acf4 cs 0x8 eflags 0x202 cr2 0 ilevel 0x8 esp 0xc18e4d24
[   1.0000030] curlwp 0xc16365c0 pid 0 lid 0 lowest kstack 0xc18e22c0
Stopped in pid 0.0 (system) at  netbsd:breakpoint+0x4:  popl    %ebp
db{0}> 

--ifacw6d3hli5glln
Content-Type: text/plain; charset=us-ascii
Content-Description: NetBSD 9.2_STABLE/i386 202207180150Z kernel boot transcript 
Content-Disposition: attachment; filename="200.netbsd-9.text"


SYSLINUX 6.04 20190226 Copyright (C) 1994-2015 H. Peter Anvin et al
No DEFAULT or UI configuration directive found!
boot: netbsd-9-snapshot console=com 
Loading /NBSD9SN... ok
[   1.0000000] multiboot: Information structure flags: 0x00000265
[   1.0000000] multiboot: Boot loader: SYSLINUX 6.04 20190226
[   1.0000000] multiboot: Command line: /NBSD9SN console=com
[   1.0000000] multiboot: 639 KB lower memory, 64384 KB upper memory
[   1.0000000] multiboot: Symbol table at 0xc1390000, length 892912 bytes
[   1.0000000] multiboot: String table at 0xc1469ff0, length 941392 bytes
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[   1.0000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[   1.0000000]     2018, 2019, 2020, 2021, 2022
[   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.

[   1.0000000] NetBSD 9.2_STABLE (GENERIC) #0: Sun Jul 17 12:56:05 UTC 2022
[   1.0000000]  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC
[   1.0000000] total memory = 65020 KB
[   1.0000000] avail memory = 43252 KB
[   1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[   1.0000030] mainbus0 (root)
[   1.0000030] ACPI: RSDP 0x00000000000F58D0 000014 (v00 BOCHS )
[   1.0000030] ACPI: RSDT 0x0000000003FE1355 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[   1.0000030] ACPI: FACP 0x0000000003FE1231 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[   1.0000030] ACPI: DSDT 0x0000000003FE0040 0011F1 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[   1.0000030] ACPI: FACS 0x0000000003FE0000 000040
[   1.0000030] ACPI: APIC 0x0000000003FE12A5 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[   1.0000030] ACPI: HPET 0x0000000003FE131D 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[   1.0000030] ACPI: 1 ACPI AML tables successfully acquired and loaded
[   1.0000030] ioapic0 at mainbus0 apid 0
[   1.0000030] cpu0 at mainbus0 apid 0
[   1.0000030] cpu0: QEMU Virtual CPU version 2.1.0, id 0x663
[   1.0000030] cpu0: package 0, core 0, smt 0
[   1.0000030] acpi0 at mainbus0: Intel ACPICA 20190405
[   1.0000030] acpi0: fixed power button present
[   1.0215831] hpet0 at acpi0: high precision event timer (mem 0xfed00000-0xfed00400)
[   1.0242080] pckbc1 at acpi0 (KBD, PNP0303) (kbd port): io 0x60,0x64 irq 1
[   1.0242080] pckbc2 at acpi0 (MOU, PNP0F13) (aux port): irq 12
[   1.0242080] FDC0 (PNP0700) at acpi0 not configured
[   1.0242080] LPT (PNP0400) at acpi0 not configured
[   1.0242080] COM1 (PNP0501) at acpi0 not configured
[   1.0242080] qemufwcfg0 at acpi0 (FWCF, QEMU0002): io 0x510-0x511
[   1.0242080] apm0 at acpi0: Power Management spec V1.2
[   1.0242080] ACPI: Enabled 2 GPEs in block 00 to 0F
[   1.0242080] pckbd0 at pckbc1 (kbd slot)
[   1.0242080] pckbc1: using irq 1 for kbd slot
[   1.0242080] wskbd0 at pckbd0 mux 1
[   1.0242080] pms0 at pckbc1 (aux slot)
[   1.0242080] pckbc1: using irq 12 for aux slot
[   1.0242080] wsmouse0 at pms0 mux 0
[   1.0242080] pci0 at mainbus0 bus 0: configuration mode 1
[   1.0242080] pchb0 at pci0 dev 0 function 0: vendor 8086 product 1237 (rev. 0x02)
[   1.0242080] pcib0 at pci0 dev 1 function 0: vendor 8086 product 7000 (rev. 0x00)
[   1.0242080] piixide0 at pci0 dev 1 function 1: Intel 82371SB IDE Interface (PIIX3) (rev. 0x00)
[   1.0242080] piixide0: primary channel interrupting at ioapic0 pin 14
[   1.0242080] atabus0 at piixide0 channel 0
[   1.0242080] piixide0: secondary channel interrupting at ioapic0 pin 15
[   1.0242080] atabus1 at piixide0 channel 1
[   1.0242080] piixpm0 at pci0 dev 1 function 3: vendor 8086 product 7113 (rev. 0x03)
[   1.0242080] piixpm0: 24-bit timer
[   1.0242080] piixpm0: interrupting at ioapic0 pin 9
[   1.0242080] iic0 at piixpm0 port 0: I2C bus
[   1.0242080] vga0 at pci0 dev 2 function 0: vendor 1013 product 00b8 (rev. 0x00)
[   1.0242080] wsdisplay0 at vga0 kbdmux 1
[   1.0242080] drm at vga0 not configured
[   1.0242080] wm0 at pci0 dev 3 function 0: Intel i82540EM 1000BASE-T Ethernet (rev. 0x03)
[   1.0242080] wm0: interrupting at ioapic0 pin 11
[   1.0242080] wm0: Ethernet address 52:54:00:12:34:56
[   1.0242080] makphy0 at wm0 phy 1: Marvell 88E1011 Gigabit PHY, rev. 0
[   1.0242080] makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[   1.0242080] isa0 at pcib0
[   1.0242080] lpt0 at isa0 port 0x378-0x37b irq 7
[   1.0242080] com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
[   1.0242080] com0: console
[   1.0242080] attimer0 at isa0 port 0x40-0x43
[   1.0242080] pcppi0 at isa0 port 0x61
[   1.0242080] midi0 at pcppi0: PC speaker
[   1.0242080] sysbeep0 at pcppi0
[   1.0242080] isapnp0 at isa0 port 0x279
[   1.0242080] fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
[   1.0242080] attimer0: attached to pcppi0
[   1.0242080] acpicpu0 at cpu0: ACPI CPU
[   1.4678140] fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
[   4.7326077] wd0 at atabus0 drive 0
[   4.7326077] wd0: <QEMU HARDDISK>
[   4.7326077] wd0: 49152 KB, 97 cyl, 16 head, 63 sec, 512 bytes/sect x 98304 sectors
[   4.7526426] atapibus0 at atabus1: 2 targets
[   4.7526426] cd0 at atapibus0 drive 0: <QEMU DVD-ROM, QM00003, 2.1.0> cdrom removable
[   4.7726765] boot device: <unknown>
[   4.7726765] root device: 

--ifacw6d3hli5glln
Content-Type: text/plain; charset=us-ascii
Content-Description: Syslinux configuration 
Content-Disposition: attachment; filename="200.netbsd.conf"


SERIAL 0 9600

LABEL   netbsd-9-snapshot
COM32   mboot.c32
APPEND  /NBSD9SN

LABEL   netbsd-10-snapshot
COM32   mboot.c32
APPEND  /NBSD10SN


--ifacw6d3hli5glln
Content-Type: text/plain; charset=us-ascii
Content-Description: $ mdir -/a output for the boot filesystem 
Content-Disposition: attachment; filename="200.netbsd-mdir.text"

 Volume in drive Y has no label
 Volume Serial Number is 3046-FBBF
Directory for Y:/

NBSD9SN       20706564 2022-07-17  12:56 
NBSD10SN      25417540 2022-07-16  19:46 
SYSLINUX     <DIR>     2022-07-19  13:07 
        3 files          46 124 104 bytes

Directory for Y:/SYSLINUX

.            <DIR>     2022-07-19  13:07 
..           <DIR>     2022-07-19  13:07 
CHAIN    C32     25060 2019-02-26  23:35 
CMD      C32      1240 2019-02-26  23:35 
LIBCOM32 C32    169996 2019-02-26  23:35 
LIBUTIL  C32     22724 2019-02-26  23:35 
MBOOT    C32     10872 2019-02-26  23:35 
ldlinux  sys     60416 2022-07-19  13:13 
ldlinux  c32    119296 2022-07-19  13:13 
SYSLINUX CFG       142 2022-07-19  13:17 
       10 files             409 746 bytes

Total files listed:
       13 files          46 533 850 bytes
                            443 392 bytes free


--ifacw6d3hli5glln--

>Unformatted:
 --ifacw6d3hli5glln
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 Content-Transfer-Encoding: 8bit
 



Home | Main Index | Thread Index | Old Index