summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-06-21 12:43:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-06-21 21:24:14 +0200
commit6adec4f77ad0aff851d0abf505a430ebb7329d4e (patch)
tree5bcc62ad248db49a8f49a796e59fb38d2bb36310 /sal
parente07dbd3c144295c37b1d4ccdc77e3896b9c63dce (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/56242
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>(