gecko/toolkit/crashreporter/breakpad-patches/17-bug942407-usersig.patch

39 lines
1.5 KiB
Diff

# HG changeset patch
# User Jed Davis <jld@mozilla.com>
Bug 942407: Fix breakpad signal handler's test for signal origin. r=ted
diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
index 55834e0..df958fb 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
@@ -334,20 +334,20 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
if (handled) {
signal(sig, SIG_DFL);
} else {
RestoreHandlersLocked();
}
pthread_mutex_unlock(&handler_stack_mutex_);
- if (info->si_pid) {
- // This signal was triggered by somebody sending us the signal with kill().
- // In order to retrigger it, we have to queue a new signal by calling
- // kill() ourselves.
+ if (info->si_code <= 0) {
+ // This signal was sent by another process. (Positive values of
+ // si_code are reserved for kernel-originated signals.) In order
+ // to retrigger it, we have to queue a new signal.
if (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.
_exit(1);
}
} else {
// This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV).
--
1.8.4.rc3