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

linux emulation



Hi all,

I've just installed yet another i386 box with 3.1 (fresh & clean
install, no patches yet). I want to run a GIMPS[1] client on this
machine and downloaded a statically linked linux binary.

With a GENERIC kernel the program core dumps on me :
$ ./mprime -m
Bad system call (core dumped)

A ktrace gave me :
$ ktrace ./mprime -m
Bad system call (core dumped)
$ kdump
  4630 ktrace   RET   ktrace 0
  4630 ktrace   CALL  execve(0xdfbfdb3b,0xdfbfdb08,0xdfbfdb14)
  4630 ktrace   NAMI  "./mprime"
  4630 mprime   EMUL  "svr4"
  4630 mprime   RET   execve 0
  4630 mprime   CALL  setegid(0)
  4630 mprime   RET   setegid -1 errno 1 Operation not permitted
  4630 mprime   CALL  msgsys(0xdfbfdbc0,0xdfbfdbb4,0xdfbfdb50,0x80930a7,0xdfbfdbb4)
  4630 mprime   RET   msgsys -1 errno 22 Invalid argument
  4630 mprime   CALL  getuid
  4630 mprime   RET   getuid 864/0x360
  4630 mprime   CALL  #45 (unimplemented plock)
  4630 mprime   PSIG  SIGSYS SIG_DFL code -529282264
  4630 mprime   NAMI  "mprime.core"

Notice the 'EMUL  "svr4"' .. that doesn't compute for me (I *know*
this is a linux binary, I've checked it on some random linux box). I
thought GENERIC had COMPAT_LINUX enabled (and it has in my
srcsys.tar.gz's ./sys/arch/i386/conf/GENERIC).

So I built myself a custom kernel with all emulations except Linux
turned off (I threw in a couple of hardware-related changes in as
well, the kernel boots fine, no problem there).

With this new kernel, the program doesn't dump core (not in the first
few minutes at least) and it does hog my CPU (which is a bit early, I
have to configure it first (hence the '-m' for the menu)). No action
on a Ctrl-D or Ctrl-C, a Ctrl-\ makes it dump core again.

This time, a ktrace shows me that the program tries to stat
/proc/meminfo :
...
  3163 ktrace   RET   ktrace 0
  3163 ktrace   CALL  execve(0xdfbfda93,0xdfbfda64,0xdfbfda6c)
  3163 ktrace   NAMI  "./mprime"
  3163 mprime   EMUL  "linux"
...

(that problem is fixed ;)

...
  3163 mprime   CALL  open(0x80bc608,0,0x1b6)
  3163 mprime   NAMI  "/emul/linux/proc/meminfo"
  3163 mprime   NAMI  "/proc/meminfo"
...

So, I `mkdir /proc && mount -t procfs -o linux /proc /proc` and try
again. Same result, ktrace shows :
$ ktrace ./mprime -m
^\Quit (core dumped)

$ kdump
  6694 ktrace   RET   ktrace 0
  6694 ktrace   CALL  execve(0xdfbfdbc7,0xdfbfdb94,0xdfbfdba0)
  6694 ktrace   NAMI  "./mprime"
  6694 mprime   EMUL  "linux"
  6694 mprime   RET   oldolduname 0
  6694 mprime   CALL  personality(0)
  6694 mprime   RET   personality 0
  6694 mprime   CALL  linux_geteuid16
  6694 mprime   RET   linux_geteuid16 864/0x360
  6694 mprime   CALL  linux_getuid16
  6694 mprime   RET   linux_getuid16 864/0x360
  6694 mprime   CALL  linux_getegid16
  6694 mprime   RET   linux_getegid16 864/0x360
  6694 mprime   CALL  linux_getgid16
  6694 mprime   RET   linux_getgid16 864/0x360
  6694 mprime   CALL  brk(0)
  6694 mprime   RET   brk 136691712/0x825c000
  6694 mprime   CALL  brk(0x825c020)
  6694 mprime   RET   brk 136691744/0x825c020
  6694 mprime   CALL  brk(0x825d000)
  6694 mprime   RET   brk 136695808/0x825d000
  6694 mprime   CALL  getpid
  6694 mprime   RET   getpid 6694/0x1a26
  6694 mprime   CALL  rt_sigaction(0xf,0xdfbfd7d0,0xdfbfd744,0x8)
  6694 mprime   RET   rt_sigaction 0
  6694 mprime   CALL  rt_sigaction(0x2,0xdfbfd7d0,0xdfbfd744,0x8)
  6694 mprime   RET   rt_sigaction 0
  6694 mprime   CALL  chdir(0xdfbfd9e4)
  6694 mprime   NAMI  "."
  6694 mprime   RET   chdir 0
  6694 mprime   CALL  open(0x80c97c0,0,0x1b6)
  6694 mprime   NAMI  "prime.ini"
  6694 mprime   RET   open -1 errno 2 No such file or directory
  6694 mprime   CALL  time(0xdfbfd994)
  6694 mprime   RET   time 1026265278/0x3d2b90be
  6694 mprime   CALL  open(0x80c9820,0,0x1b6)
  6694 mprime   NAMI  "local.ini"
  6694 mprime   RET   open -1 errno 2 No such file or directory
  6694 mprime   CALL  open(0x80baeb9,0,0xdfbfdae4)
  6694 mprime   NAMI  "PRIMENET.DLL"
  6694 mprime   RET   open -1 errno 2 No such file or directory
  6694 mprime   CALL  open(0x80c97c0,0,0x1b6)
  6694 mprime   NAMI  "prime.ini"
  6694 mprime   RET   open -1 errno 2 No such file or directory
  6694 mprime   CALL  open(0x825c0a0,0x241,0x1b6)
  6694 mprime   NAMI  "prime.ini"
  6694 mprime   RET   open 3
  6694 mprime   CALL  write(0x3,0xdfbfd8dc,0xa)
  6694 mprime   GIO   fd 3 wrote 10 bytes
       "UseHTTP=1
       "
  6694 mprime   RET   write 10/0xa
  6694 mprime   CALL  close(0x3)
  6694 mprime   RET   close 0
  6694 mprime   CALL  open(0x80bc608,0,0x1b6)
  6694 mprime   NAMI  "/emul/linux/proc/meminfo"
  6694 mprime   NAMI  "/proc/meminfo"
  6694 mprime   RET   open 3
  6694 mprime   CALL  fstat(0x3,0xdfbfd738)
  6694 mprime   RET   fstat 0
  6694 mprime   CALL  mmap(0xdfbfd784)
  6694 mprime   RET   mmap 1208778752/0x480c8000
  6694 mprime   CALL  read(0x3,0x480c8000,0x1000)
  6694 mprime   GIO   fd 3 read 313 bytes
       "        total:    used:    free:  shared: buffers: cached:
	Mem:  47157248 16068608 31088640        0        0        0
	Swap: 67104768        0 67104768
	MemTotal:     46052 kB
	MemFree:      30360 kB
	MemShared:        0 kB
	Buffers:          0 kB
	Cached:           0 kB
	SwapTotal:    65532 kB
	SwapFree:     65532 kB
       "
  6694 mprime   RET   read 313/0x139
  6694 mprime   CALL  close(0x3)
  6694 mprime   RET   close 0
  6694 mprime   CALL  munmap(0x480c8000,0x1000)
  6694 mprime   RET   munmap 0
  6694 mprime   CALL  open(0x80bc608,0,0x1b6)
  6694 mprime   NAMI  "/emul/linux/proc/meminfo"
  6694 mprime   NAMI  "/proc/meminfo"
  6694 mprime   RET   open 3
  6694 mprime   CALL  fstat(0x3,0xdfbfd738)
  6694 mprime   RET   fstat 0
  6694 mprime   CALL  mmap(0xdfbfd784)
  6694 mprime   RET   mmap 1208778752/0x480c8000
  6694 mprime   CALL  read(0x3,0x480c8000,0x1000)
  6694 mprime   GIO   fd 3 read 313 bytes
       "        total:    used:    free:  shared: buffers: cached:
	Mem:  47157248 16068608 31088640        0        0        0
	Swap: 67104768        0 67104768
	MemTotal:     46052 kB
	MemFree:      30360 kB
	MemShared:        0 kB
	Buffers:          0 kB
	Cached:           0 kB
	SwapTotal:    65532 kB
	SwapFree:     65532 kB
       "
  6694 mprime   RET   read 313/0x139
  6694 mprime   CALL  close(0x3)
  6694 mprime   RET   close 0
  6694 mprime   CALL  munmap(0x480c8000,0x1000)
  6694 mprime   RET   munmap 0
  6694 mprime   CALL  rt_sigaction(0x4,0xdfbfd73c,0xdfbfd6b0,0x8)
  6694 mprime   RET   rt_sigaction 0
  6694 mprime   PSIG  SIGILL caught handler=0x805cd68 mask=0x0 addr=0x805cf15 trapno=0
  6694 mprime   CALL  rt_sigaction(0x4,0xdfbfd73c,0xdfbfd6b0,0x8)
  6694 mprime   RET   rt_sigaction 0
  6694 mprime   CALL  rt_sigaction(0x4,0xdfbfd73c,0xdfbfd6b0,0x8)
  6694 mprime   RET   rt_sigaction 0
  6694 mprime   PSIG  SIGILL caught handler=0x805cd68 mask=0x8 addr=0x805ceb9 trapno=0
  6694 mprime   PSIG  SIGILL caught handler=0x805cd68 mask=0x8 addr=0x805ceb9 trapno=0
  6694 mprime   PSIG  SIGILL caught handler=0x805cd68 mask=0x8 addr=0x805ceb9 trapno=0
...

(the last line repeats .. the longer I wait with my SIGQUIT, the more
lines I get (ktrace.out grows *VERY* quickly)).

Anyone know what I could try next ? Perhaps someone already runs GIMPS
on an i386 OpenBSD machine .. any pointers ? What does SIGILL mean ?
According to sigaction(2) :

SIGILL          create core image       illegal instruction

I suppose there's a problem with rt_sigaction, but this is *way*
over my head I'm affraid ;P

TIA

Paul 'WEiRD' de Weerd

[1] Great Internet Mersenne Prime Search, a distributed search for
large primes, compare SETI@home et al. The binary I'm trying to run
here came from : ftp://mersenne.org/gimps/sprime21c.tar.gz
More info : http://www.mersenne.org/

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/