epic4 2.10 appears to have a rather serious bug that caused several
crashes for me recently.  I don't know if this has been found/fixed
yet, but just in case it hasn't...

Symptom:  Epic crashes with a SIGSEGV immediately after receiving
SIGPIPE.

Reason:  signal_handlers[SIGPIPE] is an invalid function pointer

Details:  Someone apparently decided to replace the libc signal()
function with the home-grown my_signal().  Unfortunately, while
function pointers passed to my_signal() are handled properly, there
are two values that are not: SIG_DFL and SIG_IGN.  While it's possible
that SIG_DFL will evaluate to NULL on a particular platform, that
shouldn't be counted upon; furthermore, SIG_IGN couldn't possibly be
the same value as SIG_DFL even if SIG_DFL was NULL, so at *best*
there's 1 unhandled value (SIG_IGN).  And that value happens to be
used in main()'s calls to my_signal().

The result is that signal_handlers[SIGPIPE] gets set to something
other than NULL, and when epic receives SIGPIPE, it tries to call the
function located at 0x00000001.

The attached patch implements the correct behavior. :)  I handle both
alternate values properly despite the fact that SIG_DFL is often equal
to NULL; a proper optimizing compiler will collapse the "duplicate"
test.

HTH,
Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <[EMAIL PROTECTED]>
Linux Server/Cluster Admin, LBL.gov       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "The notion that something as complex and thermodynamically
  improbable as life could form out of a bit of ooze is about as
  believable as a jet airliner being assembled during a hurricane in a
  junkyard."                       -- Fred Hoyle (quoted by Sonia Shah)
diff -Nur -x '*.orig' -x '*.rej' epic4-2.10/source/ircsig.c 
mezzanine_patched_epic4-2.10/source/ircsig.c
--- epic4-2.10/source/ircsig.c  2008-03-13 17:12:53.000000000 -0700
+++ mezzanine_patched_epic4-2.10/source/ircsig.c        2008-07-23 
10:36:51.000000000 -0700
@@ -66,7 +66,9 @@
 {
        signals_caught[0] = 1;
        signals_caught[sig_no]++;
-       if (NULL != signal_handlers[sig_no])
+       if ((NULL != signal_handlers[sig_no])
+        && (signal_handlers[sig_no] != SIG_IGN)
+        && (signal_handlers[sig_no] != SIG_DFL))
                signal_handlers[sig_no](sig_no);
 }
 
_______________________________________________
List mailing list
List@epicsol.org
http://epicsol.org/mailman/listinfo/list

Reply via email to