NetBSD-Bugs archive

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

kern/55047: Missing COMPAT_43 Syscalls on amd64 for COMPAT_09 and COMPAT_NOMID



>Number:         55047
>Category:       kern
>Synopsis:       ogetpagesize needed for NetBSD 0.8-0.9
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 05 00:10:00 +0000 2020
>Originator:     Dan Plassche
>Release:        NetBSD 9.99.48 Tue Mar 3 00:00 UTC
>Environment:
		System: NetBSD nbsd90 9.99.48 NetBSD 9.99.48 (UNIX) #0: 
			Tue Mar 3 00:04:47 UTC 2020 dp@nbsd90:
			/usr/src/sys/arch/amd64/compile/UNIX amd64
		Architecture: x86_64
		Machine: amd64
>Description:

Compile a custom kernel on amd64 to enable COMPAT_NOMID and EXEC_AOUT.  Then 
disable null memory protection with sysctl -w "vm.user_va0_disable=0" to 
execute old NetBSD 0.8-0.9, 386BSD 0.0-0.1, and BSDi 1.0 binaries.  

Running any of these binaries results in an error calling the ogetpagesize 
syscall that is not implemented on amd64.  

I notice that the syscall works and is defined on i386 in /usr/src/sys/
compat/common/vm_43.c.  The syscall is not defined in compat_netbsd32.  

Example

nbsd90# ktrace /emul/nbsd-09/bin/ls; kdump
[1]   Bad system call (core dumped) ktrace /emul/nbsd-09/bin/ls
   852      1 ktrace   EMUL  "netbsd"
   852      1 ktrace   CALL  execve(0x7f7fffe81be7,0x7f7fffe81650,
0x7f7fffe81660)
   852      1 ktrace   NAMI  "/emul/nbsd-09/bin/ls"
   852      1 ls       NAMI  "/emul/netbsd32"
   852      1 ls       EMUL  "netbsd32"
   852      1 ls       RET   execve JUSTRETURN
   852      1 ls       CALL  netbsd32_ioctl(1,TIOCGETA,0xffffed54)
   852      1 ls       GIO   fd 1 read 44 bytes
       "\^B+\0\0\a\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^?\0\M^V\0\0\0\M^V\0\0"
   852      1 ls       RET   netbsd32_ioctl 0
   852      1 ls       CALL  netbsd32_ioctl(1,TIOCGWINSZ,0xffffed98)
   852      1 ls       GIO   fd 1 read 8 bytes
       "0\0P\0\0\0\0\0"
   852      1 ls       RET   netbsd32_ioctl 0
   852      1 ls       CALL  getuid
   852      1 ls       RET   getuid 0
   852      1 ls       CALL  compat_43_netbsd32_stat43(0xffffed96,0xffffed3c)
   852      1 ls       NAMI  "."
   852      1 ls       RET   compat_43_netbsd32_stat43 0
   852      1 ls       CALL  compat_43_ogetpagesize
   852      1 ls       RET   compat_43_ogetpagesize -1 errno 78 Function not 
implemented
   852      1 ls       PSIG  SIGSYS SIG_DFL: code=SI_NOINFO
   852      1 ls       NAMI  "ls.core"

>Fix:

Add ogetpagesize to compat_netbsd32 in /usr/src/sys/compat/netbsd32/
netbsd32_compat_43.c.  It might be worthwhile to add owait,
ogetdtablesize, osigvec, oquota, and ogethostid as well.



Home | Main Index | Thread Index | Old Index