Title: [250541] trunk
Revision
250541
Author
[email protected]
Date
2019-09-30 20:23:58 -0700 (Mon, 30 Sep 2019)

Log Message

[JSC] HeapSnapshotBuilder m_rootData should be protected with a lock too
https://bugs.webkit.org/show_bug.cgi?id=202389
<rdar://problem/50717564>

Reviewed by Mark Lam.

JSTests:

* stress/heap-analyzer-taking-lock.js: Added.

Source/_javascript_Core:

While we are protecting HeapSnapshotBuilder::m_edges with a lock, we are not protecting m_rootData, which is also concurrently modified.
This patch protects it.

* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::setOpaqueRootReachabilityReasonForCell):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (250540 => 250541)


--- trunk/JSTests/ChangeLog	2019-10-01 00:50:46 UTC (rev 250540)
+++ trunk/JSTests/ChangeLog	2019-10-01 03:23:58 UTC (rev 250541)
@@ -1,3 +1,13 @@
+2019-09-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] HeapSnapshotBuilder m_rootData should be protected with a lock too
+        https://bugs.webkit.org/show_bug.cgi?id=202389
+        <rdar://problem/50717564>
+
+        Reviewed by Mark Lam.
+
+        * stress/heap-analyzer-taking-lock.js: Added.
+
 2019-09-30  Saam Barati  <[email protected]>
 
         Inline caching is wrong for custom accessors and custom values

Added: trunk/JSTests/stress/heap-analyzer-taking-lock.js (0 => 250541)


--- trunk/JSTests/stress/heap-analyzer-taking-lock.js	                        (rev 0)
+++ trunk/JSTests/stress/heap-analyzer-taking-lock.js	2019-10-01 03:23:58 UTC (rev 250541)
@@ -0,0 +1,8 @@
+// Should not crash.
+let array = [];
+for (let i = 0; i < 10000; i++) {
+    array[i] = new DataView(new ArrayBuffer());
+}
+for (let i = 0; i < 1000; i++) {}
+
+generateHeapSnapshotForGCDebugging();

Modified: trunk/Source/_javascript_Core/ChangeLog (250540 => 250541)


--- trunk/Source/_javascript_Core/ChangeLog	2019-10-01 00:50:46 UTC (rev 250540)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-10-01 03:23:58 UTC (rev 250541)
@@ -1,3 +1,17 @@
+2019-09-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] HeapSnapshotBuilder m_rootData should be protected with a lock too
+        https://bugs.webkit.org/show_bug.cgi?id=202389
+        <rdar://problem/50717564>
+
+        Reviewed by Mark Lam.
+
+        While we are protecting HeapSnapshotBuilder::m_edges with a lock, we are not protecting m_rootData, which is also concurrently modified.
+        This patch protects it.
+
+        * heap/HeapSnapshotBuilder.cpp:
+        (JSC::HeapSnapshotBuilder::setOpaqueRootReachabilityReasonForCell):
+
 2019-09-30  Saam Barati  <[email protected]>
 
         Inline caching is wrong for custom accessors and custom values

Modified: trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp (250540 => 250541)


--- trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp	2019-10-01 00:50:46 UTC (rev 250540)
+++ trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp	2019-10-01 03:23:58 UTC (rev 250541)
@@ -150,6 +150,8 @@
     if (!reason || !*reason || m_snapshotType != SnapshotType::GCDebuggingSnapshot)
         return;
 
+    std::lock_guard<Lock> lock(m_buildingEdgeMutex);
+
     m_rootData.ensure(cell, [] () -> RootData {
         return { };
     }).iterator->value.reachabilityFromOpaqueRootReasons = reason;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to