Subject: port-amd64/32388: kernel panic while running NetBSD/i386 binaries with COMPAT_NETBSD32
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <njoly@pasteur.fr>
List: netbsd-bugs
Date: 12/26/2005 18:25:00
>Number:         32388
>Category:       port-amd64
>Synopsis:       kernel panic while running NetBSD/i386 binaries with COMPAT_NETBSD32
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 26 18:25:00 +0000 2005
>Originator:     Nicolas Joly
>Release:        NetBSD 3.99.15
>Organization:
Institut Pasteur, Paris.
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 3.99.15 NetBSD 3.99.15 (LANFEUST) #1: Mon Dec 26 13:43:31 CET 2005 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
Trying to run a netbsd32 (or linux32, even if unsupported), will crash a
-current NetBSD/amd64 kernel.

njoly@lanfeust [emul/netbsd32]> pkg_info | grep netbsd32
netbsd32_compat16-1.0nb1 32-bit shared libraries for NetBSD 1.6 (and earlier) compatibility

njoly@lanfeust [emul/netbsd32]> file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for NetBSD 2.0D, dynamically linked (uses shared libs), for NetBSD 2.0D, not stripped
njoly@lanfeust [emul/netbsd32]> ./hello
[...PANIC...]

kernel: page fault trap, code=0
Stopped in pid 10605.1 (zsh) at netbsd:exec_read_from+0x36:     movq    0(%rax), %rax
db{0}> mach cpu 0
using CPU 0
db{0}> bt
exec_read_from() at netbsd:exec_read_from+0x36
netbsd_elf32_signature() at netbsd:netbsd_elf32_signature+0x61
netbsd32_elf32_probe() at netbsd:netbsd32_elf32_probe+0x34
exec_elf32_makecmds() at netbsd:exec_elf32_makecmds+0x36f
check_exec() at netbsd:check_exec+0x1fd
execve1() at netbsd:execve1+0x164
syscall_plain() at netbsd:syscall_plain+0xfb
--- syscall (number 5313192) ---
0x5112aing CPU 1
db{0}> bt
__cpu_simple_lock_try() at netbsd:__cpu_simple_lock_try+0xd
_simple_lock_try() at netbsd:_simple_lock_try+0x57
_kernel_lock_acquire_count() at netbsd:_kernel_lock_acquire_count+0x7a
mi_switch() at netbsd:mi_switch+0x145
ltsleep() at netbsd:ltsleep+0x4e0
pollcommon() at netbsd:pollcommon+0x269
sys_poll() at netbsd:sys_poll+0x67
syscall_plain() at netbsd:syscall_plain+0xfb
kernel: page fault trap, code=0
Faulted in DDB; continuing...

This backtrace is from a slightly modified GENERIC.MP kernel (+DDB,+DIAGNOSTIC,
+LOCKDEBUG,+COMPAT_LINUX). I was able to reproduce this problem with a
simple GENERIC kernel too (the machine reboots ...).
>How-To-Repeat:
Try to run a NetBSD/i386 binary on a -current NetBSD/amd64 ...
>Fix: