NetBSD Problem Report #55547
From dp@nbsd90-32.bsdnix.net Fri Aug 7 00:26:03 2020
Return-Path: <dp@nbsd90-32.bsdnix.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 99E651A923A
for <gnats-bugs@gnats.NetBSD.org>; Fri, 7 Aug 2020 00:26:03 +0000 (UTC)
Message-Id: <20200807002601.24E6A365A0C@nbsd90-32.bsdnix.net>
Date: Thu, 6 Aug 2020 20:26:01 -0400 (EDT)
From: dplassche@gmail.com
Reply-To: dplassche@gmail.com
To: gnats-bugs@NetBSD.org
Subject: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working Compat in Current
X-Send-Pr-Version: 3.95
>Number: 55547
>Category: kern
>Synopsis: Mem. Access Error for Prev. Working BSDi 2 Binaries on NetBSD 8+
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 07 00:30:00 +0000 2020
>Closed-Date: Sun Aug 09 04:01:24 +0000 2020
>Last-Modified: Thu Aug 13 00:25:01 +0000 2020
>Originator: Dan Plassche
>Release: NetBSD 9.99.48
>Organization:
>Environment:
System: NetBSD 9.99.48 (UNIX) #0: Sat Feb 29 18:58:03 EST 2020 dp@nbsd90-32.bsdnix.net:/usr/src/sys/arch/i386/compile/UNIX i386
Architecture: i386
Machine: i386
>Description:
Documenting problem with BSDi 2+ binaries using shared
libraries after user reported they stopped working and
requested help with NetBSD 9.0 on the port-amd64
mailing list this month in August 2020.
Background:
1. Other static a.out binaries from 386BSD, NetBSD
0.8-0.9, and BSDi BSD/386 1.0 had stopped working
amid compat code refractoring starting in NetBSD 8.0,
but the problem was corrected in March 2020 so those
binaries again run on both i386 and amd64 after
PR/55025 and PR/55047.
2. BSDi BSD/OS 2.0 binaries depend on static shared
libraries in an executable format. Those binaries
ran properly on NetBSD 1-7 by loading /shlib when
started from a chroot. They stopped working from
NetBSD 8 onwards as added memory protection was
introduced.
3. Turning off tunable null and ASLR memory protection
did not resolve the problem.
4. BSDi 2 binaries never worked outside of a chroot
containing a copy of the userland and libraries.
5. BSD/OS 2.0 is the first BSDi release based on 4.4BSD
and should work.
>How-To-Repeat:
- Build a kernel with COMPAT_NOMID set in addition to
the required options that are already included in
GENERIC (include "conf/compat_netbsd09.config" and
EXEC_AOUT).
- Disable null memory protection with "sysctl -w
vm.user_va0_disable=0" which is required to run
NetBSD 0.8-9 and BSD/386 1.0 binaries on current and
worked to run BSD/OS 2.0 binaries on NetBSD 7.
- Optionally install emulators/compat12 from pkgsrc to
setup the /emul directory tree
- Extract BSD/OS 2.0 sets under /emul/bsdos-2
- # chroot /emul/bsdos-2 /bin/sh
The problem appears related to protected memory access as shown from the
ktrace results from a working run on NetBSD 7 versus the failed run on
NetBSD 9.99.48 below.
ktrace from succesfully entering BSD/OS 2.0 chroot in NetBSD 7:
1001 1 ktrace EMUL "netbsd"
1001 1 ktrace CALL execve(0xbfbfe948,0xbfbfede0,0xbfbfedf0)
1001 1 ktrace NAMI "/home/dp/bin/chroot"
1001 1 ktrace RET execve -1 errno 2 No such file or directory
1001 1 ktrace CALL execve(0xbfbfe948,0xbfbfede0,0xbfbfedf0)
1001 1 ktrace NAMI "/bin/chroot"
1001 1 ktrace RET execve -1 errno 2 No such file or directory
1001 1 ktrace CALL execve(0xbfbfe948,0xbfbfede0,0xbfbfedf0)
1001 1 ktrace NAMI "/sbin/chroot"
1001 1 ktrace RET execve -1 errno 2 No such file or directory
1001 1 ktrace CALL execve(0xbfbfe948,0xbfbfede0,0xbfbfedf0)
1001 1 ktrace NAMI "/usr/bin/chroot"
1001 1 ktrace RET execve -1 errno 2 No such file or directory
1001 1 ktrace CALL execve(0xbfbfe948,0xbfbfede0,0xbfbfedf0)
1001 1 ktrace NAMI "/usr/sbin/chroot"
1001 1 ktrace NAMI "/usr/libexec/ld.elf_so"
1001 1 chroot EMUL "netbsd"
1001 1 chroot RET execve JUSTRETURN
1001 1 chroot CALL mmap(0,0x8000,3,0x1002,0xffffffff,0,0,0)
1001 1 chroot RET mmap -1145155584/0xbbbe5000
1001 1 chroot CALL open(0xbbbfa8c0,0,0)
1001 1 chroot NAMI "/etc/ld.so.conf"
1001 1 chroot RET open -1 errno 2 No such file or directory
1001 1 chroot CALL open(0xbfbfe6c8,0,0)
1001 1 chroot NAMI "/usr/lib/libgcc_s.so.1"
1001 1 chroot RET open 3
1001 1 chroot CALL __fstat50(3,0xbfbfe614)
1001 1 chroot RET __fstat50 0
1001 1 chroot CALL mmap(0,0x1000,1,1,3,0,0,0)
1001 1 chroot RET mmap -1145159680/0xbbbe4000
1001 1 chroot CALL munmap(0xbbbe4000,0x1000)
1001 1 chroot RET munmap 0
1001 1 chroot CALL mmap(0,0xc000,5,2,3,0,0,0)
1001 1 chroot RET mmap -1145204736/0xbbbd9000
1001 1 chroot CALL mmap(0xbbbe4000,0x1000,3,0x12,3,0,0xa000,0)
1001 1 chroot RET mmap -1145159680/0xbbbe4000
1001 1 chroot CALL mmap(0xbbbe5000,0,3,0x1012,0xffffffff,0,0,0)
1001 1 chroot RET mmap -1145155584/0xbbbe5000
1001 1 chroot CALL close(3)
1001 1 chroot RET close 0
1001 1 chroot CALL open(0xbfbfe6c8,0,0xbfbfe614)
1001 1 chroot NAMI "/usr/lib/libc.so.12"
1001 1 chroot RET open 3
1001 1 chroot CALL __fstat50(3,0xbfbfe614)
1001 1 chroot RET __fstat50 0
1001 1 chroot CALL mmap(0,0x1000,1,1,3,0,0,0)
1001 1 chroot RET mmap -1145208832/0xbbbd8000
1001 1 chroot CALL munmap(0xbbbd8000,0x1000)
1001 1 chroot RET munmap 0
1001 1 chroot CALL mmap(0,0x166000,5,2,3,0,0,0)
1001 1 chroot RET mmap -1146671104/0xbba73000
1001 1 chroot CALL mmap(0xbbbc0000,0x8000,3,0x12,3,0,0x14c000,0)
1001 1 chroot RET mmap -1145307136/0xbbbc0000
1001 1 chroot CALL mmap(0xbbbc8000,0x11000,3,0x1012,0xffffffff,0,0,0)
1001 1 chroot RET mmap -1145274368/0xbbbc8000
1001 1 chroot CALL close(3)
1001 1 chroot RET close 0
1001 1 chroot CALL _lwp_setprivate(0xbbbeb040)
1001 1 chroot RET _lwp_setprivate 0
1001 1 chroot CALL _lwp_self
1001 1 chroot RET _lwp_self 1
1001 1 chroot CALL __sigprocmask14(1,0xbfbfed44,0xbfbfeda0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL __sigprocmask14(3,0xbfbfeda0,0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL __sysctl(0xbbb8f630,2,0xbbbd7a40,0xbfbfecfc,0,0)
1001 1 chroot RET __sysctl 0
1001 1 chroot CALL _lwp_self
1001 1 chroot RET _lwp_self 1
1001 1 chroot CALL __sigprocmask14(1,0xbfbfed0c,0xbfbfeda0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL __sigprocmask14(3,0xbfbfeda0,0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL _lwp_self
1001 1 chroot RET _lwp_self 1
1001 1 chroot CALL __sigprocmask14(1,0xbfbfed0c,0xbfbfeda0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL __sigprocmask14(3,0xbfbfeda0,0)
1001 1 chroot RET __sigprocmask14 0
1001 1 chroot CALL chdir(0xbfbffeb3)
1001 1 chroot NAMI "/emul/bsdos-2"
1001 1 chroot RET chdir 0
1001 1 chroot CALL chroot(0x80490a1)
1001 1 chroot NAMI "."
1001 1 chroot RET chroot 0
1001 1 chroot CALL execve(0xbfbffec1,0xbfbfedec,0xbfbfedf4)
1001 1 chroot NAMI "/bin/sh"
1001 1 sh EMUL "netbsd"
1001 1 sh RET execve JUSTRETURN
1001 1 sh CALL open(0x10c8,0,0)
1001 1 sh NAMI "/shlib/libc_s.2.0"
1001 1 sh RET open 3
1001 1 sh CALL mmap(0xa0000000,0x1000,5,0x110,3,0,0,0)
1001 1 sh RET mmap -1610612736/0xa0000000
1001 1 sh CALL mmap(0xa0001000,0x37000,5,0x12,3,0,0x1000,0)
1001 1 sh RET mmap -1610608640/0xa0001000
1001 1 sh CALL mmap(0xa0400000,0x6000,7,0x12,3,0,0x38000,0)
1001 1 sh RET mmap -1606418432/0xa0400000
1001 1 sh CALL mmap(0xa0406000,0xa28c,7,0x1010,0xffffffff,0,0,0)
1001 1 sh RET mmap -1606393856/0xa0406000
1001 1 sh CALL close(3)
1001 1 sh RET close 0
1001 1 sh CALL open(0x10da,0,0xbfbffff0)
1001 1 sh NAMI "/shlib/libcompat_s.2.0"
1001 1 sh RET open 3
1001 1 sh CALL mmap(0xac000000,0x1000,5,0x12,3,0,0,0)
1001 1 sh RET mmap -1409286144/0xac000000
1001 1 sh CALL mmap(0xac001000,0x3000,5,0x12,3,0,0x1000,0)
1001 1 sh RET mmap -1409282048/0xac001000
1001 1 sh CALL mmap(0xac400000,0x1000,7,0x12,3,0,0x4000,0)
1001 1 sh RET mmap -1405091840/0xac400000
1001 1 sh CALL mmap(0xac401000,0,7,0x1010,0xffffffff,0,0,0)
1001 1 sh RET mmap -1405087744/0xac401000
1001 1 sh CALL close(3)
1001 1 sh RET close 0
1001 1 sh CALL open(0x10f1,0,0xbfbffff0)
1001 1 sh NAMI "/shlib/libtermcap_s.2.0"
1001 1 sh RET open 3
1001 1 sh CALL mmap(0xae000000,0x1000,5,0x12,3,0,0,0)
1001 1 sh RET mmap -1375731712/0xae000000
1001 1 sh CALL mmap(0xae001000,0x2000,5,0x12,3,0,0x1000,0)
1001 1 sh RET mmap -1375727616/0xae001000
1001 1 sh CALL mmap(0xae400000,0x1000,7,0x12,3,0,0x3000,0)
1001 1 sh RET mmap -1371537408/0xae400000
1001 1 sh CALL mmap(0xae401000,0,7,0x1010,0xffffffff,0,0,0)
1001 1 sh RET mmap -1371533312/0xae401000
1001 1 sh CALL close(3)
1001 1 sh RET close 0
1001 1 sh CALL getpid
1001 1 sh RET getpid 1001/0x3e9, 2076/0x81c
1001 1 sh CALL geteuid
1001 1 sh RET geteuid 0
1001 1 sh CALL __sysctl(0xbfbffd94,2,0xbfbffda0,0xbfbffd9c,0,0)
1001 1 sh RET __sysctl 0
1001 1 sh CALL break(0x213ec)
1001 1 sh RET break 0
1001 1 sh CALL break(0x21ffc)
1001 1 sh RET break 0
1001 1 sh CALL break(0x22ffc)
1001 1 sh RET break 0
1001 1 sh CALL ioctl(0,TIOCGETA,0xbfbffda8)
1001 1 sh GIO fd 0 read 44 bytes
"\^B+\0\0\^C\0\0\0\0K\0\0\M-K\^E\0 \^D\M^?\M^?\^?\^W\^U\^R\M^?\^C\^\\^Z\
\^Y\^Q\^S\^V\^O\^A\0\^T\M^?\M^@%\0\0\M^@%\0\0"
1001 1 sh RET ioctl 0
1001 1 sh CALL ioctl(1,TIOCGETA,0xbfbffda8)
1001 1 sh GIO fd 1 read 44 bytes
"\^B+\0\0\^C\0\0\0\0K\0\0\M-K\^E\0 \^D\M^?\M^?\^?\^W\^U\^R\M^?\^C\^\\^Z\
\^Y\^Q\^S\^V\^O\^A\0\^T\M^?\M^@%\0\0\M^@%\0\0"
1001 1 sh RET ioctl 0
1001 1 sh CALL compat_13_sigaction13(SIGINT,0,0xbfbffd94)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGINT,0xbfbffd90,0xbfbffd84)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGQUIT,0,0xbfbffd90)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGQUIT,0xbfbffd8c,0xbfbffd80)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTERM,0,0xbfbffd8c)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTERM,0xbfbffd88,0xbfbffd7c)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL break(0x23ffc)
1001 1 sh RET break 0
1001 1 sh CALL ioctl(2,TIOCGPGRP,0x20064)
1001 1 sh GIO fd 2 read 4 bytes
"\M-i\^C\0\0"
1001 1 sh RET ioctl 0
1001 1 sh CALL getpgrp
1001 1 sh RET getpgrp 1001/0x3e9
1001 1 sh CALL compat_13_sigaction13(SIGTSTP,0,0xbfbffd90)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTSTP,0xbfbffd8c,0xbfbffd80)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTTOU,0,0xbfbffd8c)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTTOU,0xbfbffd88,0xbfbffd7c)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTTIN,0,0xbfbffd88)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL compat_13_sigaction13(SIGTTIN,0xbfbffd84,0xbfbffd78)
1001 1 sh RET compat_13_sigaction13 0
1001 1 sh CALL setpgid(0,0x3e9)
1001 1 sh RET setpgid 0
1001 1 sh CALL ioctl(2,TIOCSPGRP,0x213c8)
1001 1 sh GIO fd 2 wrote 4 bytes
"\M-i\^C\0\0"
1001 1 sh RET ioctl 0
1001 1 sh CALL open(0xbfbffed0,0,0x10c4)
1001 1 sh NAMI "/home/dp/.shrc"
1001 1 sh RET open -1 errno 2 No such file or directory
1001 1 sh CALL compat_50_wait4(0xffffffff,0xbfbffd60,3,0)
1001 1 sh RET compat_50_wait4 -1 errno 10 No child processes
1001 1 sh CALL break(0x24ffc)
1001 1 sh RET break 0
1001 1 sh CALL write(2,0x24000,2)
1001 1 sh GIO fd 2 wrote 2 bytes
"# "
1001 1 sh RET write 2
1001 1 sh CALL read(0,0x20230,0x3ff)
1001 1 sh GIO fd 0 read 5 bytes
"exit\n"
1001 1 sh RET read 5
1001 1 sh CALL break(0x25ffc)
1001 1 sh RET break 0
1001 1 sh CALL getpid
1001 1 sh RET getpid 1001/0x3e9, 2076/0x81c
1001 1 sh CALL setpgid(0,0x3e9)
1001 1 sh RET setpgid 0
1001 1 sh CALL ioctl(2,TIOCSPGRP,0x20064)
1001 1 sh GIO fd 2 wrote 4 bytes
"\M-i\^C\0\0"
1001 1 sh RET ioctl 0
1001 1 sh CALL exit(0)
ktrace from failed BSD/OS 2.0 chroot on NetBSD current:
407 1 ktrace EMUL "netbsd"
407 1 ktrace CALL execve(0xbfb03cec,0xbfb041a8,0xbfb041b8)
407 1 ktrace NAMI "/home/dp/bin/chroot"
407 1 ktrace RET execve -1 errno 2 No such file or directory
407 1 ktrace CALL execve(0xbfb03cec,0xbfb041a8,0xbfb041b8)
407 1 ktrace NAMI "/bin/chroot"
407 1 ktrace RET execve -1 errno 2 No such file or directory
407 1 ktrace CALL execve(0xbfb03cec,0xbfb041a8,0xbfb041b8)
407 1 ktrace NAMI "/sbin/chroot"
407 1 ktrace RET execve -1 errno 2 No such file or directory
407 1 ktrace CALL execve(0xbfb03cec,0xbfb041a8,0xbfb041b8)
407 1 ktrace NAMI "/usr/bin/chroot"
407 1 ktrace RET execve -1 errno 2 No such file or directory
407 1 ktrace CALL execve(0xbfb03cec,0xbfb041a8,0xbfb041b8)
407 1 ktrace NAMI "/usr/sbin/chroot"
407 1 ktrace NAMI "/usr/libexec/ld.elf_so"
407 1 chroot EMUL "netbsd"
407 1 chroot RET execve JUSTRETURN
407 1 chroot CALL mmap(0,0x8000,PROT_READ|PROT_WRITE,0x1002<PRIVATE,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1197043712/0xb8a69000
407 1 chroot CALL open(0xbb1675df,0,0)
407 1 chroot NAMI "/etc/ld.so.conf"
407 1 chroot RET open -1 errno 2 No such file or directory
407 1 chroot CALL open(0xbfb4c474,0,0)
407 1 chroot NAMI "/usr/lib/libc.so.12"
407 1 chroot RET open 5
407 1 chroot CALL __fstat50(5,0xbfb4c3b8)
407 1 chroot RET __fstat50 0
407 1 chroot CALL mmap(0,0x1000,PROT_READ,0x1<SHARED,FILE,ALIGN=NONE>,5,0,0,0)
407 1 chroot RET mmap -1197047808/0xb8a68000
407 1 chroot CALL munmap(0xb8a68000,0x1000)
407 1 chroot RET munmap 0
407 1 chroot CALL mmap(0,0x1d7000,PROT_READ|PROT_EXEC,0x2<PRIVATE,FILE,ALIGN=NONE>,5,0,0,0)
407 1 chroot RET mmap -1198972928/0xb8892000
407 1 chroot CALL mmap(0xb8a42000,0xb000,PROT_READ|PROT_WRITE,0x12<PRIVATE,FIXED,FILE,ALIGN=NONE>,5,0,0x1af000,0)
407 1 chroot RET mmap -1197203456/0xb8a42000
407 1 chroot CALL mmap(0xb8a4d000,0x1c000,PROT_READ|PROT_WRITE,0x1012<PRIVATE,FIXED,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1197158400/0xb8a4d000
407 1 chroot CALL close(5)
407 1 chroot RET close 0
407 1 chroot CALL mprotect(0xb8a42000,0x7000,PROT_READ)
407 1 chroot RET mprotect 0
407 1 chroot CALL mprotect(0x72a000,0x1000,PROT_READ)
407 1 chroot RET mprotect 0
407 1 chroot CALL _lwp_setprivate(0xb8a6d9b0)
407 1 chroot RET _lwp_setprivate 0
407 1 chroot CALL _lwp_self
407 1 chroot RET _lwp_self 1
407 1 chroot CALL __sigprocmask14(1,0xbfb4cb00,0xbfb4cb78)
407 1 chroot RET __sigprocmask14 0
407 1 chroot CALL __sigprocmask14(3,0xbfb4cb78,0)
407 1 chroot RET __sigprocmask14 0
407 1 chroot CALL readlink(0xb8a02c20,0xbfb4c63f,0x400)
407 1 chroot NAMI "/etc/malloc.conf"
407 1 chroot RET readlink -1 errno 2 No such file or directory
407 1 chroot CALL issetugid
407 1 chroot RET issetugid 0
407 1 chroot CALL __sysctl(0xbfb4c9bc,2,0xb8a5d040,0xbfb4c9b8,0,0)
407 1 chroot RET __sysctl 0
407 1 chroot CALL mmap(0,0x1000,PROT_NONE,0x1002<PRIVATE,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1198977024/0xb8891000
407 1 chroot CALL madvise(0xb8891000,0x1000,6)
407 1 chroot RET madvise 0
407 1 chroot CALL munmap(0xb8891000,0x1000)
407 1 chroot RET munmap 0
407 1 chroot CALL mmap(0,0x200000,PROT_READ|PROT_WRITE,0x1002<PRIVATE,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1201070080/0xb8692000
407 1 chroot CALL munmap(0xb8692000,0x200000)
407 1 chroot RET munmap 0
407 1 chroot CALL mmap(0,0x3ff000,PROT_READ|PROT_WRITE,0x15001002<PRIVATE,ANONYMOUS,ALIGN=2MB>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1203765248/0xb8400000
407 1 chroot CALL munmap(0xb8600000,0x1ff000)
407 1 chroot RET munmap 0
407 1 chroot CALL __clock_gettime50(3,0xbfb4c9b8)
407 1 chroot RET __clock_gettime50 0
407 1 chroot CALL __clock_gettime50(3,0xbfb4c9b8)
407 1 chroot RET __clock_gettime50 0
407 1 chroot CALL __clock_gettime50(3,0xbfb4c9d4)
407 1 chroot RET __clock_gettime50 0
407 1 chroot CALL mmap(0,0x7000,PROT_READ|PROT_WRITE,0x1002<PRIVATE,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1199001600/0xb888b000
407 1 chroot CALL mmap(0,0x1000,PROT_READ|PROT_WRITE,0x1002<PRIVATE,ANONYMOUS,ALIGN=NONE>,0xffffffff,0,0,0)
407 1 chroot RET mmap -1199005696/0xb888a000
407 1 chroot CALL __sysctl(0xbfb4ca40,2,0xbfb4ca2c,0xbfb4ca24,0,0)
407 1 chroot RET __sysctl 0
407 1 chroot CALL __sysctl(0xb8a08704,2,0xb8a5c220,0xbfb4ca84,0,0)
407 1 chroot RET __sysctl 0
407 1 chroot CALL _lwp_self
407 1 chroot RET _lwp_self 1
407 1 chroot CALL __sigprocmask14(1,0xbfb4ca94,0xbfb4cb78)
407 1 chroot RET __sigprocmask14 0
407 1 chroot CALL __sigprocmask14(3,0xbfb4cb78,0)
407 1 chroot RET __sigprocmask14 0
407 1 chroot CALL chdir(0xbfb4d07f)
407 1 chroot NAMI "/emul/bsdos-2"
407 1 chroot RET chdir 0
407 1 chroot CALL chroot(0x729229)
407 1 chroot NAMI "."
407 1 chroot RET chroot 0
407 1 chroot CALL execve(0xbfb4d08d,0xbfb4cbc4,0xbfb4cbcc)
407 1 chroot NAMI "/bin/sh"
407 1 sh EMUL "netbsd"
407 1 sh RET execve JUSTRETURN
407 1 sh PSIG SIGSEGV SIG_DFL: code=SEGV_ACCERR, addr=0x1020, trap=4)
407 1 sh NAMI "sh.core"
>Fix:
Issue appears related to failure to load executable static shared libs under
/shlib in BSD/OS 2.0 due to memory protection changes starting in NetBSD 8.
Building a completely static executable on BSD/OS 2.0 under NetBSD 7 was not
possible in my efforts to test further. Building a trivial program with
shlicc -Bstatic still pulled in libc_s.2.0.
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55547 CVS commit: src/sys
Date: Sat, 8 Aug 2020 15:08:49 -0400
Module Name: src
Committed By: christos
Date: Sat Aug 8 19:08:48 UTC 2020
Modified Files:
src/sys/arch/i386/i386: trap.c
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: cpu.c
src/sys/compat/netbsd32: netbsd32_mod.c
Log Message:
PR/55547: Dan Plassche: Fix BSD/OS binary emulation.
Centralize lcall sniffer and recognize the BSD/OS flavor.
To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/netbsd32/netbsd32_mod.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Sat, 8 Aug 2020 23:10:09 +0000
On Fri, Aug 07, 2020 at 12:30:00AM +0000, dplassche@gmail.com wrote:
> Building a completely static executable on BSD/OS 2.0 under NetBSD 7 was not
> possible in my efforts to test further. Building a trivial program with
> shlicc -Bstatic still pulled in libc_s.2.0.
If you want a static executable, use cc, not shlicc.
--
David A. Holland
dholland@netbsd.org
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
dplassche@gmail.com
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Sat, 8 Aug 2020 19:19:19 -0400
--Apple-Mail=_B02B1E43-BD96-4B42-84BF-1E41C20CCB1B
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Both static and dynamic binaries work now.
christos
--Apple-Mail=_B02B1E43-BD96-4B42-84BF-1E41C20CCB1B
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXy8y9wAKCRBxESqxbLM7
OuO1AJ9jZwGc5Si6Ipnw/tdjNbGKFU5wZgCg4sV1Pu5oTv0pLgUYQqqoFvy79NA=
=UyvG
-----END PGP SIGNATURE-----
--Apple-Mail=_B02B1E43-BD96-4B42-84BF-1E41C20CCB1B--
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 09 Aug 2020 04:01:24 +0000
State-Changed-Why:
Christos fixed it.
From: Dan Plassche <dplassche@gmail.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Mon, 10 Aug 2020 23:33:10 -0400
On 2020-08-08 19:19, Christos Zoulas wrote:
> Both static and dynamic binaries work now.
>
> christos
>
I updated and was able to successfully run BSDi 2 binaries directly now
on HEAD (9.99.69) on amd64. Really great to see this happen, thank you!
I found that after updating to HEAD on i386 the BSDi 2 binaries and
other previously working early NetBSD a.out binaries now failed although
they all ran on amd64.
I've sent you further details off list, but a sample for NetBSD 1.0 is
below and please feel free to tell me if I need to file a new PR.
# ktrace /emul/nbsd-10/bin/ls; kdump
[1] Segmentation fault (core dumped) ktrace /emul/nbsd-10/bin/ls
833 833 ktrace EMUL "netbsd"
833 833 ktrace CALL execve(0xbfbfee1f,0xbfbfe950,0xbfbfe958)
833 833 ktrace NAMI "/emul/nbsd-10/bin/ls"
833 833 ls EMUL "netbsd"
833 833 ls RET execve JUSTRETURN
833 833 ls PSIG SIGSEGV SIG_DFL: code=SEGV_ACCERR,
addr=0x172f8, trap=4)
833 833 ls NAMI "ls.core"
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
dplassche@gmail.com
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Tue, 11 Aug 2020 00:30:41 -0400
--Apple-Mail=_1416DC27-304D-49AB-B89D-5206A6601417
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Should be fixed now.
christos
--Apple-Mail=_1416DC27-304D-49AB-B89D-5206A6601417
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXzIe8QAKCRBxESqxbLM7
OibhAJ44TFE99FMLQETeb69okx0pxkBbigCeNOi28FsoxlyuN+N9lQ2vVOyHMf4=
=nI7n
-----END PGP SIGNATURE-----
--Apple-Mail=_1416DC27-304D-49AB-B89D-5206A6601417--
From: Dan Plassche <dplassche@gmail.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Tue, 11 Aug 2020 19:17:04 -0400
On 2020-08-11 00:30, Christos Zoulas wrote:
> Should be fixed now.
>
> christos
>
On 9.99.70 on i386 NetBSD 0.9 and 1.0 binaries now work again. However,
nomid binaries from the releases below fail after the commits in this PR
on i386 although they work on amd64:
386BSD 0.1
NetBSD 0.8
BSD/386 1.0
BSD/OS 2.0
The binaries are not being recognized anymore and fail with syntax
errors about unexpected symbols.
- Dan
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
dplassche@gmail.com
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Wed, 12 Aug 2020 12:12:17 -0400
--Apple-Mail=_7862C76A-E1B2-4F91-88F7-5FC3D97646A5
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
> On 9.99.70 on i386 NetBSD 0.9 and 1.0 binaries now work again. However,
> nomid binaries from the releases below fail after the commits in this PR
> on i386 although they work on amd64:
>
> 386BSD 0.1
> NetBSD 0.8
> BSD/386 1.0
> BSD/OS 2.0
>
> The binaries are not being recognized anymore and fail with syntax
> errors about unexpected symbols.
Did you add COMPAT_NOMID to the kernel config?
It works for me.
christos
--Apple-Mail=_7862C76A-E1B2-4F91-88F7-5FC3D97646A5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXzQU4QAKCRBxESqxbLM7
OtixAJ9Y67Og0265IpLAbXud8tWKTcJmYwCg8URs3npbQCYmrr6Shecn2elU2Ls=
=I+MN
-----END PGP SIGNATURE-----
--Apple-Mail=_7862C76A-E1B2-4F91-88F7-5FC3D97646A5--
From: Dan Plassche <dplassche@gmail.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55547: BSDi 2.0 Binaries Fail with SEGV_ACCERR on Working
Compat in Current
Date: Wed, 12 Aug 2020 20:20:07 -0400
On 2020-08-12 12:12, Christos Zoulas wrote:
>
> Did you add COMPAT_NOMID to the kernel config?
> It works for me.
Ah, I typoed COMPAT_NOMID when redoing my kernel config after checking
out a clean copy of the sources to control the test setup for the latest
round.
All good now.
- Dan
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.