Bug 1395504 - Infinite hang of web content process when parent process crashes r?ted.mielczarek draft
authorHaik Aftandilian <haftandilian@mozilla.com>
Wed, 11 Apr 2018 11:53:06 -0700
changeset 781492 d6ed114c762f61a125ab7515c3883622d2e47f6f
parent 781491 0cf8fbcf50a382dc219fd9796df9a8018e1e57dc
push id106312
push userhaftandilian@mozilla.com
push dateThu, 12 Apr 2018 23:43:57 +0000
reviewersted.mielczarek
bugs1395504
milestone61.0a1
Bug 1395504 - Infinite hang of web content process when parent process crashes r?ted.mielczarek Don't free memory in exception handling context to avoid deadlocks. Replace old_handler_.reset() with old_handler_.release() to intentionally leak the sigaction struct instead. MozReview-Commit-ID: lUNygOJCUL
toolkit/crashreporter/breakpad-client/mac/handler/exception_handler.cc
--- a/toolkit/crashreporter/breakpad-client/mac/handler/exception_handler.cc
+++ b/toolkit/crashreporter/breakpad-client/mac/handler/exception_handler.cc
@@ -689,17 +689,22 @@ bool ExceptionHandler::UninstallHandler(
   kern_return_t result = KERN_SUCCESS;
 
   if (old_handler_.get()) {
     sigaction(SIGABRT, old_handler_.get(), NULL);
 #if USE_PROTECTED_ALLOCATIONS
     mprotect(gProtectedData.protected_buffer, PAGE_SIZE,
         PROT_READ | PROT_WRITE);
 #endif
-    old_handler_.reset();
+    if (in_exception) {
+      old_handler_.release();
+    } else {
+      // this delete should NOT happen if an exception just occurred!
+      old_handler_.reset();
+    }
     gProtectedData.handler = NULL;
   }
 
   if (installed_exception_handler_) {
     mach_port_t current_task = mach_task_self();
 
     // Restore the previous ports
     for (unsigned int i = 0; i < previous_->count; ++i) {