Subject: kern/10653: Something funky in Linux emulation signal handling
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tls@cs.stevens-tech.edu>
List: netbsd-bugs
Date: 07/21/2000 14:28:18
>Number: 10653
>Category: kern
>Synopsis: sigreturn can return nonsensical values with x86 Linux emulation
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 21 14:29:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: tls@cs.stevens-tech.edu
>Release: NetBSD-1.5_ALPHA as of 20000711
>Organization:
Computer Science Department, Stevens Institute of Technology
>Environment:
System: NetBSD breakup-bock.cs.stevens-tech.edu 1.5_ALPHA NetBSD 1.5_ALPHA (BOCK) #0: Tue Jul 11 18:29:15 EDT 2000 root@amstel.cs.stevens-tech.edu:/usr/src/sys/arch/i386/compile/BOCK i386
>Description:
While attempting to run the PVS theorem prover, which includes a
modified Allegro Common Lisp binary for Linux, the interpreter
failed with the evident belief that it'd received a SIGEMT.
Investigation with ktrace/kdump revealed that in fact the process
had received a SIGBUS, which *might* be a normal consequence of
its garbage collection algorithm; we are investigating this with
SRI and Allegro currently. In any event, the kdump output reveals
an abnormal return from sigreturn(2) with a nonsensical error
value which does not appear to be present in the code (-2).
Conclusion: *something* is hosed with Linux emulation signal
handling, whether the registration of handlers or the actual
delivery of signals, in 1.5_ALPHA on the x86. Here is the kdump
output:
562 pvs-allegro5.0 EMUL "linux"
562 pvs-allegro5.0 RET select 1
562 pvs-allegro5.0 CALL read(0,0x20118855,0x200)
562 pvs-allegro5.0 GIO fd 0 read 8 bytes
"(grind)
"
562 pvs-allegro5.0 RET read 8
562 pvs-allegro5.0 CALL times(0xbfbf61e8)
562 pvs-allegro5.0 RET times 33063190/0x1f88116
562 pvs-allegro5.0 CALL times(0xbfbf5c38)
562 pvs-allegro5.0 RET times 33063193/0x1f88119
562 pvs-allegro5.0 CALL times(0xbfbf5c38)
562 pvs-allegro5.0 RET times 33063193/0x1f88119
562 pvs-allegro5.0 CALL times(0xbfbf5d38)
562 pvs-allegro5.0 RET times 33063194/0x1f8811a
562 pvs-allegro5.0 CALL times(0xbfbf5d38)
562 pvs-allegro5.0 RET times 33063194/0x1f8811a
562 pvs-allegro5.0 CALL brk(0x806b000)
562 pvs-allegro5.0 RET brk 134656000/0x806b000
562 pvs-allegro5.0 CALL old_mmap(0xbfbf5cb4)
562 pvs-allegro5.0 RET old_mmap 1210507264/0x4826e000
562 pvs-allegro5.0 CALL rt_sigprocmask(0,0,0x4824c1d0,0x8)
562 pvs-allegro5.0 RET rt_sigprocmask 0
562 pvs-allegro5.0 CALL rt_sigaction(0x2,0xbfbf5b28,0xbfbf5a9c,0x8)
562 pvs-allegro5.0 RET rt_sigaction 0
562 pvs-allegro5.0 CALL rt_sigaction(0x2,0xbfbf5c3c,0,0x8)
562 pvs-allegro5.0 RET rt_sigaction 0
562 pvs-allegro5.0 PSIG SIGBUS caught handler=0x481c4318 mask=() code=0x4
562 pvs-allegro5.0 CALL sigreturn(0xbfbf5e7c)
562 pvs-allegro5.0 RET sigreturn -1 errno -2 No such file or directory
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0x6a)
562 pvs-allegro5.0 GIO fd 1 wrote 106 bytes
"Error: Received signal number 7 (EMT instruction)
[condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL]
"
562 pvs-allegro5.0 RET write 106/0x6a
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0x2b)
562 pvs-allegro5.0 GIO fd 1 wrote 43 bytes
"
Restart actions (select using :continue):
"
562 pvs-allegro5.0 RET write 43/0x2b
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0x4)
562 pvs-allegro5.0 GIO fd 1 wrote 4 bytes
" 0: "
562 pvs-allegro5.0 RET write 4
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0x28)
562 pvs-allegro5.0 GIO fd 1 wrote 40 bytes
"Return to Top Level (an "abort" restart)"
562 pvs-allegro5.0 RET write 40/0x28
562 pvs-allegro5.0 CALL select(0x1,0xbfbf5770,0,0,0xbfbf57f0)
562 pvs-allegro5.0 RET select 0
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0x1)
562 pvs-allegro5.0 GIO fd 1 wrote 1 bytes
"
"
562 pvs-allegro5.0 RET write 1
562 pvs-allegro5.0 CALL write(0x1,0x20118a5c,0xd)
562 pvs-allegro5.0 GIO fd 1 wrote 13 bytes
"[1] PVS(20): "
562 pvs-allegro5.0 RET write 13/0xd
562 pvs-allegro5.0 CALL select(0x1,0xbfbf5548,0,0,0)
>How-To-Repeat:
To repeat this problem, you'll probably need a copy of the PVS
distribution or another source of the Allegro interpreter binary.
To get PVS, follow the links from http://pvs.csl.sri.com/announce.html
to the download directory on the SRI FTP server. You'll want the
"Redhat Linux 5" version. You'll then need to frob the "pvs" shell
script so it thinks NetBSD is a version of Linux, and make symlinks
named "libdl.so" and "libm.so" in your /emul/linux/lib because for
some reason the Allegro interpreter has no shared library version
numbers in the names it tries to load. Then all you need to do is
try to prove a conjecture; one of the ones from the PVS tutorial
will do nicely. When the (grind) call to actually do the work is
executed, the Allegro interpreter splodes as described above. I'm
sure there are simpler Lisp procedures that will splode the
interpreter but I haven't found one yet.
>Fix:
Unknown. This needs attention from someone who understands the
intricacies of signal delivery on x86 and the Linux compat code.
>Release-Note:
>Audit-Trail:
>Unformatted: