OLD | NEW |
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // previously installed handler. Then, when the signal is retriggered, it will | 334 // previously installed handler. Then, when the signal is retriggered, it will |
335 // be delivered to the appropriate handler. | 335 // be delivered to the appropriate handler. |
336 if (handled) { | 336 if (handled) { |
337 signal(sig, SIG_DFL); | 337 signal(sig, SIG_DFL); |
338 } else { | 338 } else { |
339 RestoreHandlersLocked(); | 339 RestoreHandlersLocked(); |
340 } | 340 } |
341 | 341 |
342 pthread_mutex_unlock(&handler_stack_mutex_); | 342 pthread_mutex_unlock(&handler_stack_mutex_); |
343 | 343 |
344 if (info->si_pid) { | 344 if (info->si_pid || sig == SIGABRT) { |
345 // This signal was triggered by somebody sending us the signal with kill(). | 345 // This signal was triggered by somebody sending us the signal with kill(). |
346 // In order to retrigger it, we have to queue a new signal by calling | 346 // In order to retrigger it, we have to queue a new signal by calling |
347 // kill() ourselves. | 347 // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is |
| 348 // due to the kernel sending a SIGABRT from a user request via SysRQ. |
348 if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { | 349 if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { |
349 // If we failed to kill ourselves (e.g. because a sandbox disallows us | 350 // If we failed to kill ourselves (e.g. because a sandbox disallows us |
350 // to do so), we instead resort to terminating our process. This will | 351 // to do so), we instead resort to terminating our process. This will |
351 // result in an incorrect exit code. | 352 // result in an incorrect exit code. |
352 _exit(1); | 353 _exit(1); |
353 } | 354 } |
354 } else { | 355 } else { |
355 // This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV). | 356 // This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV). |
356 // No need to reissue the signal. It will automatically trigger again, | 357 // No need to reissue the signal. It will automatically trigger again, |
357 // when we return from the signal handler. | 358 // when we return from the signal handler. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 descriptor.UpdatePath(); | 687 descriptor.UpdatePath(); |
687 if (!google_breakpad::WriteMinidump(descriptor.path(), | 688 if (!google_breakpad::WriteMinidump(descriptor.path(), |
688 child, | 689 child, |
689 child_blamed_thread)) | 690 child_blamed_thread)) |
690 return false; | 691 return false; |
691 | 692 |
692 return callback ? callback(descriptor, callback_context, true) : true; | 693 return callback ? callback(descriptor, callback_context, true) : true; |
693 } | 694 } |
694 | 695 |
695 } // namespace google_breakpad | 696 } // namespace google_breakpad |
OLD | NEW |