NetBSD-Bugs archive

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

Re: kern/52342: linux ABI exit(non-zero) returns zero status to the parent process



The following reply was made to PR kern/52342; it has been noted by GNATS.

From: u-bc8k%aetey.se@localhost
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
	netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/52342: linux ABI exit(non-zero) returns zero status to the
 parent process
Date: Mon, 26 Jun 2017 14:49:22 +0200

 Thanks for paying attention.
 
 On Mon, Jun 26, 2017 at 11:40:01AM +0000, matthew green wrote:
 >  space-bird ~> file /emul/linux/usr/bin/false /emul/linux32/usr/bin/false
 >  /emul/linux/usr/bin/false:   ELF 64-bit LSB executable, x86-64, version 1 =
 >  (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, Build=
 >  ID[sha1]=3D87be6d24cdaaa0afd60da1ad48c016f5ea709410, stripped
 >  /emul/linux32/usr/bin/false: ELF 32-bit LSB executable, Intel 80386, versi=
 >  on 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, =
 >  BuildID[sha1]=3D9d82388dd6116aa6920afeba401ac10b80906fff, stripped
 >  space-bird ~> /emul/linux/usr/bin/false || echo good
 >  good
 >  space-bird ~> /emul/linux32/usr/bin/false || echo good
 >  good
 >  
 >  can you ktrace your binaries and see what happens?
 
 Sure:
 
 -----------------------
 $ file cat
 cat: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped
 $ ./cat /nosuchfile && echo BAD
 cat: /nosuchfile: No such file or directory
 BAD
 $ ktrace ./cat /nosuchfile
 cat: /nosuchfile: No such file or directory
 $ kdump
   9256      1 ktrace   EMUL  "netbsd"
   9256      1 ktrace   CALL  execve(0x7f7ffffffe7f,0x7f7fffffdcc0,0x7f7fffffdcd8)
   9256      1 ktrace   NAMI  "./cat"
   9256      1 cat      NAMI  "/emul/linux32"
   9256   9256 cat      EMUL  "linux32"
   9256   9256 cat      RET   execve -1 errno -2 No such file or directory
   9256   9256 cat      CALL  open(0xbffffe56,0,0)
   9256   9256 cat      NAMI  "/nosuchfile"
   9256   9256 cat      RET   open -1 errno -2 No such file or directory
   9256   9256 cat      CALL  netbsd32_write(2,0x80485bc,5)
   9256   9256 cat      GIO   fd 2 wrote 5 bytes
        "cat: "
   9256   9256 cat      RET   netbsd32_write 5
   9256   9256 cat      CALL  netbsd32_write(2,0xbffffe56,0xb)
   9256   9256 cat      GIO   fd 2 wrote 11 bytes
        "/nosuchfile"
   9256   9256 cat      RET   netbsd32_write 11/0xb
   9256   9256 cat      CALL  netbsd32_write(2,0x80485b8,2)
   9256   9256 cat      GIO   fd 2 wrote 2 bytes
        ": "
   9256   9256 cat      RET   netbsd32_write 2
   9256   9256 cat      CALL  netbsd32_write(2,0x8048898,0x19)
   9256   9256 cat      GIO   fd 2 wrote 25 bytes
        "No such file or directory"
   9256   9256 cat      RET   netbsd32_write 25/0x19
   9256   9256 cat      CALL  netbsd32_write(2,0x80485b4,1)
   9256   9256 cat      GIO   fd 2 wrote 1 bytes
        "\n"
   9256   9256 cat      RET   netbsd32_write 1
   9256   9256 cat      CALL  exit(1)
 $ uname -a
 NetBSD XXXX 7.1 NetBSD 7.1 (GENERIC.201703111743Z) amd64
 -----------------------
 
 My guess is that your test binaries do not use exit() but rather
 exit_group(). The use of old-style syscalls apparently is rare
 nowadays but as long as exit() is supported it would be nice if it
 behaves.
 
 



Home | Main Index | Thread Index | Old Index