sal/Library_sal.mk     |    3 +++
 sal/osl/unx/signal.cxx |   22 +++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit bd8fa5664325dd0455b62774bd9033a09a23a3af
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed Jun 14 14:52:27 2017 +0100

    use default handler for SIGALRM for fuzzers
    
    https://github.com/google/oss-fuzz/issues/671
    
    Change-Id: Ic22f279fa8ef477540afdfa06a22138c9e3a8270
    Reviewed-on: https://gerrit.libreoffice.org/38793
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index 0a2ccc4cf4cb..17d89ae79e4a 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -20,6 +20,9 @@ $(eval $(call gb_Library_set_include,sal,\
 ))
 
 $(eval $(call gb_Library_add_defs,sal,\
+       $(if $(filter $(BUILD_TYPE),FUZZERS), \
+               -DFORCE_DEFAULT_SIGNAL \
+       ) \
        $(if $(filter $(ALLOC),SYS_ALLOC TCMALLOC JEMALLOC)$(filter-out 
X$(ENABLE_RUNTIME_OPTIMIZATIONS),XTRUE), \
                -DFORCE_SYSALLOC \
        ) \
diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx
index bc13b7947e8b..c989f4b21361 100644
--- a/sal/osl/unx/signal.cxx
+++ b/sal/osl/unx/signal.cxx
@@ -83,18 +83,22 @@ struct SignalAction
     bool siginfo; // Handler's type is Handler2
 } Signals[] =
 {
-    { SIGHUP,    ACT_HIDE, SIG_DFL, false }, /* hangup */
+    { SIGHUP,    ACT_HIDE,   SIG_DFL, false }, /* hangup */
     { SIGINT,    ACT_EXIT,   SIG_DFL, false }, /* interrupt (rubout) */
-    { SIGQUIT,   ACT_EXIT,  SIG_DFL, false }, /* quit (ASCII FS) */
-    { SIGILL,    ACT_SYSTEM,  SIG_DFL, false }, /* illegal instruction (not 
reset when caught) */
+    { SIGQUIT,   ACT_EXIT,   SIG_DFL, false }, /* quit (ASCII FS) */
+    { SIGILL,    ACT_SYSTEM, SIG_DFL, false }, /* illegal instruction (not 
reset when caught) */
 /* changed from ACT_ABOUT to ACT_SYSTEM to try and get collector to run*/
     { SIGTRAP,   ACT_ABORT,  SIG_DFL, false }, /* trace trap (not reset when 
caught) */
 #if ( SIGIOT != SIGABRT )
     { SIGIOT,    ACT_ABORT,  SIG_DFL, false }, /* IOT instruction */
 #endif
+#if defined(FORCE_DEFAULT_SIGNAL)
+    { SIGABRT,   ACT_SYSTEM, SIG_DFL, false }, /* used by abort, replace 
SIGIOT in the future */
+#else
     { SIGABRT,   ACT_ABORT,  SIG_DFL, false }, /* used by abort, replace 
SIGIOT in the future */
+#endif
 #ifdef SIGEMT
-    { SIGEMT,    ACT_SYSTEM,  SIG_DFL, false }, /* EMT instruction */
+    { SIGEMT,    ACT_SYSTEM, SIG_DFL, false }, /* EMT instruction */
 /* changed from ACT_ABORT to ACT_SYSTEM to remove handler*/
 /* SIGEMT may also be used by the profiler - so it is probably not a good
 plan to have the new handler use this signal*/
@@ -102,12 +106,20 @@ plan to have the new handler use this signal*/
     { SIGFPE,    ACT_ABORT,  SIG_DFL, false }, /* floating point exception */
     { SIGKILL,   ACT_SYSTEM, SIG_DFL, false }, /* kill (cannot be caught or 
ignored) */
     { SIGBUS,    ACT_ABORT,  SIG_DFL, false }, /* bus error */
+#if defined(FORCE_DEFAULT_SIGNAL)
+    { SIGSEGV,   ACT_SYSTEM, SIG_DFL, false }, /* segmentation violation */
+#else
     { SIGSEGV,   ACT_ABORT,  SIG_DFL, false }, /* segmentation violation */
+#endif
 #ifdef SIGSYS
     { SIGSYS,    ACT_ABORT,  SIG_DFL, false }, /* bad argument to system call 
*/
 #endif
     { SIGPIPE,   ACT_HIDE,   SIG_DFL, false }, /* write on a pipe with no one 
to read it */
+#if defined(FORCE_DEFAULT_SIGNAL)
+    { SIGALRM,   ACT_SYSTEM, SIG_DFL, false }, /* alarm clock */
+#else
     { SIGALRM,   ACT_EXIT,   SIG_DFL, false }, /* alarm clock */
+#endif
     { SIGTERM,   ACT_EXIT,   SIG_DFL, false }, /* software termination signal 
from kill */
     { SIGUSR1,   ACT_SYSTEM, SIG_DFL, false }, /* user defined signal 1 */
     { SIGUSR2,   ACT_SYSTEM, SIG_DFL, false }, /* user defined signal 2 */
@@ -126,7 +138,7 @@ plan to have the new handler use this signal*/
     { SIGTTIN,   ACT_SYSTEM, SIG_DFL, false }, /* background tty read 
attempted */
     { SIGTTOU,   ACT_SYSTEM, SIG_DFL, false }, /* background tty write 
attempted */
     { SIGVTALRM, ACT_EXIT,   SIG_DFL, false }, /* virtual timer expired */
-    { SIGPROF,   ACT_SYSTEM,   SIG_DFL, false }, /* profiling timer expired */
+    { SIGPROF,   ACT_SYSTEM, SIG_DFL, false }, /* profiling timer expired */
 /*Change from ACT_EXIT to ACT_SYSTEM for SIGPROF is so that profiling signals 
do
 not get taken by the new handler - the new handler does not pass on context
 information which causes 'collect' to crash. This is a way of avoiding
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to