external/breakpad/0001-Fix-double-declaration-of-tgkill-when-using-Android-.patch.1 | 49 ++++++++++ external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 | 33 ++++++ external/breakpad/UnpackedTarball_breakpad.mk | 5 + 3 files changed, 87 insertions(+)
New commits: commit 945fa1c16e84857e16bfb7e9bd5949e4198d9c8e Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Sep 26 22:09:56 2019 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri Jan 10 10:48:23 2020 +0100 external/breakpad: glibc 2.30 declares tgkill ...so building against glibc-headers-2.30-4.fc31.x86_64 fails with > src/client/linux/handler/exception_handler.cc:109:12: error: static declaration of 'tgkill' follows non-static declaration > static int tgkill(pid_t tgid, pid_t tid, int sig) { > ^ > /usr/include/bits/signal_ext.h:29:12: note: previous declaration is here > extern int tgkill (__pid_t __tgid, __pid_t __tid, int __signal); > ^ > 1 error generated. Upstream commit <https://chromium.googlesource.com/breakpad/breakpad/+/ 7e3c165000d44fa153a3270870ed500bc8bbb461%5E%21/> "Fix double declaration of tgkill when using Android NDK Headers" looks like the perfect fit. Change-Id: I1b4805886fb7c770cf9733f34a31296e6b859d92 Reviewed-on: https://gerrit.libreoffice.org/79661 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 55556a4cebbb35f15e7989bf0a6e276db99944e3) diff --git a/external/breakpad/0001-Fix-double-declaration-of-tgkill-when-using-Android-.patch.1 b/external/breakpad/0001-Fix-double-declaration-of-tgkill-when-using-Android-.patch.1 new file mode 100644 index 000000000000..7c8a68c2451a --- /dev/null +++ b/external/breakpad/0001-Fix-double-declaration-of-tgkill-when-using-Android-.patch.1 @@ -0,0 +1,49 @@ +From 7e3c165000d44fa153a3270870ed500bc8bbb461 Mon Sep 17 00:00:00 2001 +From: Nicholas Baldwin <baldw...@google.com> +Date: Fri, 27 Oct 2017 11:44:36 -0700 +Subject: [PATCH] Fix double declaration of tgkill when using Android NDK + Headers. + +As of Android API level 16 tgkill is declared in the NDK version of +signal.h, which conflicts with the static definition found in +src/client/linux/handler/exception_handler.cc. This change removes +the static tgkill definition and replaces its use with sys_tgkill +from the linux syscall support library. + +Bug: +Change-Id: Ic70addd8a064cfa36345d86b7e36409e2089e909 +Reviewed-on: https://chromium-review.googlesource.com/738912 +Reviewed-by: Mike Frysinger <vap...@chromium.org> +--- + src/client/linux/handler/exception_handler.cc | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc +index 95005209..cd94e3b5 100644 +--- a/src/client/linux/handler/exception_handler.cc ++++ b/src/client/linux/handler/exception_handler.cc +@@ -105,12 +105,6 @@ + #define PR_SET_PTRACER 0x59616d61 + #endif + +-// A wrapper for the tgkill syscall: send a signal to a specific thread. +-static int tgkill(pid_t tgid, pid_t tid, int sig) { +- return syscall(__NR_tgkill, tgid, tid, sig); +- return 0; +-} +- + namespace google_breakpad { + + namespace { +@@ -400,7 +394,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) { + // In order to retrigger it, we have to queue a new signal by calling + // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is + // due to the kernel sending a SIGABRT from a user request via SysRQ. +- if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { ++ if (sys_tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { + // If we failed to kill ourselves (e.g. because a sandbox disallows us + // to do so), we instead resort to terminating our process. This will + // result in an incorrect exit code. +-- +2.23.0 + diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk index b70510234e38..633574cd34a7 100644 --- a/external/breakpad/UnpackedTarball_breakpad.mk +++ b/external/breakpad/UnpackedTarball_breakpad.mk @@ -23,6 +23,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\ external/breakpad/breakpad-stackwalk.patch.1 \ external/breakpad/ucontext.patch \ external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 \ + external/breakpad/0001-Fix-double-declaration-of-tgkill-when-using-Android-.patch.1 \ )) ifeq ($(COM_IS_CLANG),TRUE) commit a9df5937ee2960e6e7202c34eabafd7e222e99a1 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Aug 16 10:16:43 2018 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri Jan 10 10:48:23 2020 +0100 Handle race in external/breakpad ...that hit once in a UBSan build in UITest_calc_tests4: > soffice.bin: /data/sbergman/lo-san/core/include/com/sun/star/uno/Reference.h:420: interface_type *com::sun::star::uno::Reference<com::sun::star::xml::crypto::XXMLSecurityContext>::operator->() const [interface_type = com::sun::star::xml::crypto::XXMLSecurityContext]: Assertion `_pInterface != NULL' failed. > warn:desktop:11041:11425:desktop/source/app/sofficemain.cxx:82: minidump generated: /data/sbergman/lo-san/core/workdir/UITest/calc_tests4/user/crash//0585280b-6f1e-fa99-4b711485-60baa6f1.dmp > src/client/linux/handler/exception_handler.cc:367:34: runtime error: member call on null pointer of type 'std::vector<google_breakpad::ExceptionHandler *, std::allocator<google_breakpad::ExceptionHandler *> >' > warn:sal.osl.mutex:11041:11041:sal/osl/unx/mutex.cxx:82: pthread_mutex_destroy failed: Device or resource busy > #0 in google_breakpad::ExceptionHandler::SignalHandler(int, siginfo_t*, void*) at <null> (instdir/program/libsofficeapp.so +0x963904) > warn:unotools.config:11041:11041:unotools/source/config/configmgr.cxx:169: ConfigManager not empty > #1 at <null> (/lib64/libpthread.so.0 +0x11fbf) Change-Id: Icf46adea879c0541a297e5f54f9ce936caa9858b Reviewed-on: https://gerrit.libreoffice.org/59157 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit ac4e861203054479d06a31784a3385fc77d76b35) diff --git a/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 b/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 new file mode 100644 index 000000000000..a88c2cdd32bb --- /dev/null +++ b/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 @@ -0,0 +1,33 @@ +From caa6f1ea462d0f0c612b871106e3e309fe0290f5 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann <sberg...@redhat.com> +Date: Thu, 16 Aug 2018 09:04:35 +0200 +Subject: [PATCH] Handle race between ExceptionHandler::SignalHandler and + ~ExceptionHandler + +...where thread A is blocked locking g_handler_stack_mutex_ in SignalHandler +while thread B executes ~ExceptionHandler and sets g_handler_stack to null, but +which thread A didn't expect to be null once it acquired the lock. +--- + src/client/linux/handler/exception_handler.cc | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc +index b895f6d7..4d58e510 100644 +--- a/src/client/linux/handler/exception_handler.cc ++++ b/src/client/linux/handler/exception_handler.cc +@@ -372,8 +372,10 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) { + } + + bool handled = false; +- for (int i = g_handler_stack_->size() - 1; !handled && i >= 0; --i) { +- handled = (*g_handler_stack_)[i]->HandleSignal(sig, info, uc); ++ if (g_handler_stack_ != nullptr) { ++ for (int i = g_handler_stack_->size() - 1; !handled && i >= 0; --i) { ++ handled = (*g_handler_stack_)[i]->HandleSignal(sig, info, uc); ++ } + } + + // Upon returning from this signal handler, sig will become unmasked and then +-- +2.17.1 + diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk index e970bd5ad3f3..b70510234e38 100644 --- a/external/breakpad/UnpackedTarball_breakpad.mk +++ b/external/breakpad/UnpackedTarball_breakpad.mk @@ -13,12 +13,16 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,breakpad,0)) $(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL))) +# external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch upstreamed at +# <https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1176811> "Handle race between +# ExceptionHandler::SignalHandler and ~ExceptionHandler": $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\ external/breakpad/breakpad-use-correct-http-header.patch.1 \ external/breakpad/breakpad-wshadow.patch.1 \ external/breakpad/breakpad-wshadow2.patch.1 \ external/breakpad/breakpad-stackwalk.patch.1 \ external/breakpad/ucontext.patch \ + external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 \ )) ifeq ($(COM_IS_CLANG),TRUE) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits