<div dir="ltr">Hi!<br><br>A month ago, I sent the email below, indicating that there are bugs in Gambit that lead to program crashes, such as SIGSEGV:s.<br><br>I wish to update you on our current understanding, which is that there are no bugs in Gambit that lead to crashes, with one exception, which is upon invocation of (lambda (#!key ... #!rest ..) .. ). This is a bug that Marc mentioned on this list earlier this year. Until it is fixed, using Gambit's built-in print function is not recommended.<br>
<br>Uses that can make Gambit crash is executing code that does not completely perform typechecks, with (declare (not safe)), and feed it with unintended input data. (For instance, in a way that makes it try to access the contents of, or execute, #!unbound or #!void). It should be noted that the Gambit-internal functions, having names starting with ##, do not perform typechecks. The Termite version that was online between ~april and until the updated release the 14:th of July did something like this.<br>
<br>Also, a source of program crashes may originate from an unawareness among developers as regards the C FFI, that the arguments passed into a c-lambda may change contents, if the C-lambda in turn accesses Scheme functions. Thus, backup ___argXX you want left to the stack before invoking the Scheme world from a C function.<br>
<br>I admit that the last two paragraphs may not describe the addressed phenomena completely, the point I wanted to make with this email was just that we have not seen any bugs in Gambit causing software crashes, with one peripheral exception, as described above.<br>
<br>Thanks<br><br>Mikael<br><br>-<br><br><div class="gmail_quote">2008/7/9<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi!<br><br>We're having limited problems with our Gambit software throwing sigsegvs / bus errors, on x86 debian and on mac os x.<br>
<br>The instances we see that we have had sigsegvs / bus errors in are:<br> - when using #!unbound or #!void values in code compiled with (declare (not safe))<br>

 - when not catching exceptions (like in the example below)<br> - 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.<br>


<br>What are the best strategies to ensure that non-FFI code can never cause sigsegv:s / bus errors?<br><br>( I suppose for starters, it is not to override the default (declare (safe)) declaration. What more? )<br><br>Thanks<br>


Mikael<br><br> -<br><br>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.<br>

<br>debian:~/main$ gdb gsc<br>GNU gdb 6.4.90-debian<br>Copyright (C) 2006 Free Software Foundation, Inc.<br>GDB is free software, covered by the GNU General Public License, and you are<br>welcome to change it and/or distribute copies of it under certain conditions.<br>


Type "show copying" to see the conditions.<br>There is absolutely no warranty for GDB.  Type "show warranty" for details.<br>This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".<br>


<br>(gdb) run<br>Starting program: /usr/bin/gsc<br>Failed to read a valid object file image from memory.<br>Gambit v4.2.8<br><br>> (load "~~/lib/termite/termite")<br>"/usr/local/Gambit-C/v4.2.8/lib/termite/termite.o1"<br>


> (termite#node-init (termite#make-node "<a href="http://127.0.0.1" target="_blank"><font color="red"><b>MailScanner warning: numerical links are often malicious:</b></font> 127.0.0.1</a>" 3000))<br>ok<br>>  (termite#spawn (lambda () (raise "hi")))<br>#<thread #2><br>><br>Program received signal SIGSEGV, Segmentation fault.<br>


0x08220202 in ___H__20___kernel ()<br>(gdb) bt<br>#0  0x08220202 in ___H__20___kernel ()<br>#1  0x00000000 in ?? ()<br><br>
</blockquote></div><br></div>