Title: [187362] trunk/Source/bmalloc
Revision
187362
Author
[email protected]
Date
2015-07-24 14:29:07 -0700 (Fri, 24 Jul 2015)

Log Message

vmmap crash at _javascript_Core: 0x31cd12f6 (the _javascript_ malloc zone enumerator)
https://bugs.webkit.org/show_bug.cgi?id=147274

Reviewed by Anders Carlsson.

It's not really clear why vmmap sometimes fails to read the target
process, but we can avoid a crash when it does. This is useful because
you'll still get all the non-bmalloc data out of the target process,
and bmalloc might not even be relevant to your investigation.

* bmalloc/Zone.cpp:
(bmalloc::remoteRead): Check for failure.

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (187361 => 187362)


--- trunk/Source/bmalloc/ChangeLog	2015-07-24 21:08:16 UTC (rev 187361)
+++ trunk/Source/bmalloc/ChangeLog	2015-07-24 21:29:07 UTC (rev 187362)
@@ -1,5 +1,20 @@
 2015-07-24  Geoffrey Garen  <[email protected]>
 
+        vmmap crash at _javascript_Core: 0x31cd12f6 (the _javascript_ malloc zone enumerator)
+        https://bugs.webkit.org/show_bug.cgi?id=147274
+
+        Reviewed by Anders Carlsson.
+
+        It's not really clear why vmmap sometimes fails to read the target
+        process, but we can avoid a crash when it does. This is useful because
+        you'll still get all the non-bmalloc data out of the target process,
+        and bmalloc might not even be relevant to your investigation.
+
+        * bmalloc/Zone.cpp:
+        (bmalloc::remoteRead): Check for failure.
+
+2015-07-24  Geoffrey Garen  <[email protected]>
+
         _javascript_Core bmalloc should not register its malloc zone more than once
         https://bugs.webkit.org/show_bug.cgi?id=147273
 

Modified: trunk/Source/bmalloc/bmalloc/Zone.cpp (187361 => 187362)


--- trunk/Source/bmalloc/bmalloc/Zone.cpp	2015-07-24 21:08:16 UTC (rev 187361)
+++ trunk/Source/bmalloc/bmalloc/Zone.cpp	2015-07-24 21:29:07 UTC (rev 187362)
@@ -30,8 +30,16 @@
 
 template<typename T> static void remoteRead(task_t task, memory_reader_t reader, vm_address_t remotePointer, T& result)
 {
-    void* tmp;
-    (*reader)(task, remotePointer, sizeof(T), &tmp);
+    void* tmp = nullptr;
+    kern_return_t error = reader(task, remotePointer, sizeof(T), &tmp);
+
+    // This read sometimes fails for unknown reasons (<rdar://problem/14093757>).
+    // Avoid a crash by skipping the memcpy when this happens.
+    if (error || !tmp) {
+        fprintf(stderr, "bmalloc: error reading remote process: 0x%x\n", error);
+        return;
+    }
+
     memcpy(&result, tmp, sizeof(T));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to