Hi!
We're having limited problems with our Gambit software throwing sigsegvs / bus errors, on x86 debian and on mac os x.
The instances we see that we have had sigsegvs / bus errors in are:
- when using #!unbound or #!void values in code compiled with (declare (not safe))
- when not catching exceptions (like in the example below)
- immediately following C calls from Scheme, where the C code makes callbacks back into Scheme, though these errors may be due to us using broken FFI code.
What are the best strategies to ensure that non-FFI code can never cause sigsegv:s / bus errors?
( I suppose for starters, it is not to override the default (declare (safe)) declaration. What more? )
Thanks
Mikael
-
The following example produces sigsegv undepending on if compiled with gcc or g++. Executing (termite#spawn (lambda () (raise "hi"))) works as expected, it does not throw any sigsegv.
debian:~/main$ gdb gsc
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/gsc
Failed to read a valid object file image from memory.
Gambit v4.2.8
> (load "~~/lib/termite/termite")
"/usr/local/Gambit-C/v4.2.8/lib/termite/termite.o1"
> (termite#node-init (termite#make-node "MailScanner warning: numerical links are often malicious: 127.0.0.1" 3000))
ok
> (termite#spawn (lambda () (raise "hi")))
#<thread #2>
>
Program received signal SIGSEGV, Segmentation fault.
0x08220202 in ___H__20___kernel ()
(gdb) bt
#0 0x08220202 in ___H__20___kernel ()
#1 0x00000000 in ?? ()