Subject: port-i386/6550: Linux libc6 programs crash on calling other programs
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bsieker@techfak.uni-bielefeld.de>
List: netbsd-bugs
Date: 12/09/1998 03:16:27
>Number:         6550
>Category:       port-i386
>Synopsis:       Linux libc6 programs core dump on calling other programs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec  8 18:20:00 1998
>Last-Modified:
>Originator:     Bernd Sieker
>Organization:
Bernd Sieker
>Release:        NetBSD-1.3.2
>Environment:
NetBSD boa 1.3.2 NetBSD 1.3.2 (BOA) #1: Wed Dec  2 23:26:22 CET 1998     bernd@boa:/usr/src/sys/arch/i386/compile/BOA i386
     AMD K6-2/300, VIA Apollo Chipset
     linux-lib-2.4 pkg
     MesaGL-3.0 from RedHat rpms
     glibc2 from RedHat rpm


>Description:

Several linux programs compiled for libc6 (glibc2) core dump
(segmentation fault) wheen calling other programs. They work fine
otherwise.

Here are some excerts first from a ktrace -i of the slc program
(shading language compiler from BMRT2.4) trying to compile the
standard "plastic" shader:

 10765 ktrace   RET   ktrace 0
 10765 ktrace   CALL  execve(0xefbfd7ba,0xefbfd734,0xefbfd740)
 10765 ktrace   NAMI  "./bin/slc"
 10765 ktrace   NAMI  "/emul/linux/lib/ld-linux.so.2"
 10765 ktrace   NAMI  "/emul/linux"
 10765 ktrace   NAMI  "/emul/linux/lib/ld-linux.so.2"
 10765 slc      EMUL  "linux"
 10765 slc      RET   oldolduname JUSTRETURN
[...]
 10765 slc      CALL  open(0x4808a9ea,0,0x48089358)
 10765 slc      NAMI  "/emul/linux/lib/libm.so.6"
 10765 slc      NAMI  "/emul/linux"
 10765 slc      NAMI  "/emul/linux/lib/libm.so.6"
 10765 slc      RET   open 3
 10765 slc      CALL  mmap(0xefbfd304)
 10765 slc      RET   mmap 1208545280/0x4808f000
[...]
 10765 slc      CALL  open(0xefbfd7c6,0,0x1b6)
 10765 slc      NAMI  "./shaders/plastic.sl"
 10765 slc      RET   open 3
 10765 slc      CALL  close(0x3)
 10765 slc      RET   close 0
 10765 slc      CALL  access(0x807bf02,0x1)
 10765 slc      NAMI  "/emul/linux/lib/cpp"
 10765 slc      NAMI  "/lib/cpp"
 10765 slc      RET   access JUSTRETURN
 10765 slc      CALL  access(0x807bf0b,0x1)
 10765 slc      NAMI  "/emul/linux/usr/ccs/lib/cpp"
 10765 slc      NAMI  "/usr/ccs/lib/cpp"
 10765 slc      RET   access JUSTRETURN
 10765 slc      CALL  access(0x807bf1c,0x1)
 10765 slc      NAMI  "/emul/linux/usr/bin/cpp"
 10765 slc      NAMI  "/usr/bin/cpp"
 10765 slc      RET   access 0
 10765 slc      CALL  pipe(0xefbfd684)
 10765 slc      RET   pipe 0
 10765 slc      PSIG  SIGSEGV SIG_DFL


Another program that fails in a similar way is Randolph Schultz's 3D
modeller "mops". It happens when I tell it to write the scene to a
temporary file (which it does) and then call the rendering program (on
which it fails).

Here are excerpts from its ktrace -i output:

@@
 10774 ktrace   RET   ktrace 0
 10774 ktrace   CALL  __sysctl(0xefbfd258,0x2,0xaa58,0xefbfd260,0,0)
 10774 ktrace   RET   __sysctl 0
 10774 ktrace   CALL  break(0xaa90)
 10774 ktrace   RET   break 0
 10774 ktrace   CALL  break(0xaffc)
 10774 ktrace   RET   break 0
 10774 ktrace   CALL  break(0xbffc)
 10774 ktrace   RET   break 0
[...]
 10774 ktrace   CALL  execve(0xefbfd2c0,0xefbfd730,0xefbfd738)
 10774 ktrace   NAMI  "/usr/local/bin/mops"
 10774 ktrace   NAMI  "/emul/linux/lib/ld-linux.so.2"
 10774 ktrace   NAMI  "/emul/linux"
 10774 ktrace   NAMI  "/emul/linux/lib/ld-linux.so.2"
 10774 mops     EMUL  "linux"
[...]
 10774 mops     CALL  open(0xefbfd2f4,0,0x7273752f)
 10774 mops     NAMI  "/emul/linux/usr/lib/libMesaGLU.so.2"
 10774 mops     NAMI  "/emul/linux"
 10774 mops     NAMI  "/emul/linux/usr/lib/libMesaGLU.so.2"
 10774 mops     RET   open 3
[...]
 10774 mops     CALL  open(0xefbfd2e4,0,0x7273752f)
 10774 mops     NAMI  "/emul/linux/usr/lib/libMesaGL.so.2"
 10774 mops     NAMI  "/emul/linux"
 10774 mops     NAMI  "/emul/linux/usr/lib/libMesaGL.so.2"
 10774 mops     RET   open 3
[...]
 10774 mops     CALL  open(0x48179cae,0,0x48178358)
 10774 mops     NAMI  "/emul/linux/lib/libc.so.6"
 10774 mops     NAMI  "/emul/linux"
 10774 mops     NAMI  "/emul/linux/lib/libc.so.6"
 10774 mops     RET   open 3
[...]
 10774 mops     CALL  stat(0xefbfd420,0xefbfd358)
 10774 mops     NAMI  "/emul/linux/usr/local/bin/mops"
 10774 mops     NAMI  "/usr/local/bin/mops"
 10774 mops     RET   stat 0
[...]
 10774 mops     CALL  open(0x8358108,0x241,0x1b6)
 10774 mops     NAMI  "/emul/linux/tmp"
 10774 mops     NAMI  "/tmp/mops10774aaa"
 10774 mops     RET   open 4
 10774 mops     CALL  fstat(0x4,0xefbfbe88)
 10774 mops     RET   fstat 0
 10774 mops     CALL  mmap(0xefbfbed8)
 10774 mops     RET   mmap 1214218240/0x485f8000
 10774 mops     CALL  write(0x4,0x485f8000,0x2e4)
 10774 mops     GIO   fd 4 wrote 740 bytes
       "##RenderMan RIB-Structure 1.0
	version 3.03
	Display "(null)" "framebuffer" "rgba"
[...]
	Option "limits" "geommemory" [40000 ]
	WorldBegin
	WorldEnd
	
       "
 10774 mops     RET   write 740/0x2e4
 10774 mops     CALL  close(0x4)
 10774 mops     RET   close 0
 10774 mops     CALL  munmap(0x485f8000,0x2000)
 10774 mops     RET   munmap 0
 10774 mops     CALL  lseek(0x2,0,0x1)
 10774 mops     RET   lseek 7159/0x1bf7
 10774 mops     CALL  pipe(0xefbfbfd0)
 10774 mops     RET   pipe 0
 10774 mops     CALL  fcntl(0x4,0x2,0x1)
 10774 mops     RET   fcntl 0
 10774 mops     CALL  fcntl(0x5,0x2,0x1)
 10774 mops     RET   fcntl 0
 10774 mops     PSIG  SIGSEGV SIG_DFL


If it seems useful I can send the entire ktrace outputs. in case of
'mops' it is almost 3MB in size.


>How-To-Repeat:

Install the linux-lib 2.4 package and the glibc2-package from RedHat

install BMRT2.4beta from
  ftp://ftp.seas.gwu.edu/pub/graphics/BMRT/BMRT2.4beta.linux.tar.gz

Go to the BMRT2.4 directory and call:
  ./bin/slc ./shaders/plastic.sl

Watch it die.


Get mops 0.42a3 (not 0.42a2, it's libc5 compiled and works fine) from
  http://www.informatik.uni-rostock.de/~rschultz/mops/mops-0.42a3-linux.tar.gz

Install appropriate Mesa libraries for the linux emulation, e. g. from
  ftp://ftp.uni-bayreuth.de/pub/linux/redhat.com/contrib/libc6/i386/Mesa-3.0beta8-1.i386.rpm

Start mops, go to the view window and select "View/Quickrender" from
the menu.

Watch it die.


>Fix:

None known.

Workaround:

For slc: use the old version from BMRT2.3.6b (which is a libc5
program)

For mops: export the RIB explicitly to a file and call the renderer
stand-alone from a shell.

>Audit-Trail:
>Unformatted: