summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-06-21 12:43:46 +0200
committerAndras Timar <andras.timar@collabora.com>2018-06-27 06:42:42 +0200
commiteacb8b0bf4fd82b3cc1f392ae91dbe5dbe2b89b0 (patch)
treefeb9d2bace8c2bf07744b5a9d695d2df08b8c0d6 /sal
parent9e5a9f8f25f7e836da5f540709643e46c8f95641 (diff)
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@redhat.com> (cherry picked from commit 6417e8cda329116f0d61e0d5e55fa78207b6148c) Reviewed-on: https://gerrit.libreoffice.org/56243 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit c5d60985afcf834793684ae553c35e20484899b3)
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/signal.cxx5
1 files changed, 4 insertions, 1 deletions
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>(