[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann sbergman at redhat.com
Thu Jun 21 14:33:33 UTC 2018


 sal/osl/unx/signal.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 6417e8cda329116f0d61e0d5e55fa78207b6148c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 21 12:43:46 2018 +0200

    Don't reset signal that hasn't been set
    
    Once an in-process JVM is instantiated, it is vital that the disposition for
    SIGSEGV is not changed afterwards, as we do not make use of Java's libjsig.so
    (cf. <https://docs.oracle.com/javase/8/docs/technotes/guides/vm/
    signal-chaining.html>) in our processes.
    
    I observed sporadic SIGSEGV crashes of CppunitTest_dbaccess_RowSetClones on a
    64-core aarch64 machine (see comment at <https://github.com/flathub/
    org.libreoffice.LibreOffice/issues/42#issuecomment-395731088> "OpenJDK 10 is now
    available").  What apparently happenes is that the cppunittester process first
    sets up its signal handlers through vclbootstrapprotector, which doesn't set one
    for SIGSEGV because bSetSEGVHandler is false in sal/osl/unx/signal.cxx because
    !is_soffice_Impl().  Then later when the in-process JVM is instantiated it sets
    its handlers, including a SIGSEGV one.  Towards the end of the process,
    DeInitVCL calls osl_removeSignalHandler calls onDeInitSignal, which erroneously
    resets the SIGSEGV handler because it doesn't honor bSetSEGVHandler.  But it
    can apparently happen that JVM threads are still running at that time and are
    executing JIT'ed code that can cause SIGSEGV that relies on the JVM's handler
    being installed, which it no longer is.
    
    (This can probably also happen for soffice.bin itself, where bSetSEGVHandler
    will be true.  That will need a different, follow-up fix.)
    
    Change-Id: Ib6d99c23e57daa0b7576964908aadff511f2bb21
    Reviewed-on: https://gerrit.libreoffice.org/56232
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx
index 9a528fec327a..a96808574c2a 100644
--- a/sal/osl/unx/signal.cxx
+++ b/sal/osl/unx/signal.cxx
@@ -315,7 +315,10 @@ bool onDeInitSignal()
 
     /* Initialize the rest of the signals */
     for (int i = NoSignals - 1; i >= 0; i--)
-        if (Signals[i].Action != ACT_SYSTEM)
+        if (Signals[i].Action != ACT_SYSTEM
+            && ((bSetSEGVHandler || Signals[i].Signal != SIGSEGV)
+                && (bSetWINCHHandler || Signals[i].Signal != SIGWINCH)
+                && (bSetILLHandler || Signals[i].Signal != SIGILL)))
         {
             if (Signals[i].siginfo) {
                 act.sa_sigaction = reinterpret_cast<Handler2>(


More information about the Libreoffice-commits mailing list