|
1 # HG changeset patch |
|
2 # User Jed Davis <jld@mozilla.com> |
|
3 |
|
4 Bug 942407: Fix breakpad signal handler's test for signal origin. r=ted |
|
5 |
|
6 |
|
7 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 |
|
8 index 55834e0..df958fb 100644 |
|
9 --- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc |
|
10 +++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc |
|
11 @@ -334,20 +334,20 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) { |
|
12 if (handled) { |
|
13 signal(sig, SIG_DFL); |
|
14 } else { |
|
15 RestoreHandlersLocked(); |
|
16 } |
|
17 |
|
18 pthread_mutex_unlock(&handler_stack_mutex_); |
|
19 |
|
20 - if (info->si_pid) { |
|
21 - // This signal was triggered by somebody sending us the signal with kill(). |
|
22 - // In order to retrigger it, we have to queue a new signal by calling |
|
23 - // kill() ourselves. |
|
24 + if (info->si_code <= 0) { |
|
25 + // This signal was sent by another process. (Positive values of |
|
26 + // si_code are reserved for kernel-originated signals.) In order |
|
27 + // to retrigger it, we have to queue a new signal. |
|
28 if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { |
|
29 // If we failed to kill ourselves (e.g. because a sandbox disallows us |
|
30 // to do so), we instead resort to terminating our process. This will |
|
31 // result in an incorrect exit code. |
|
32 _exit(1); |
|
33 } |
|
34 } else { |
|
35 // This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV). |
|
36 -- |
|
37 1.8.4.rc3 |
|
38 |