Title: [198565] trunk/Source/_javascript_Core
Revision
198565
Author
[email protected]
Date
2016-03-22 17:19:47 -0700 (Tue, 22 Mar 2016)

Log Message

REGRESSION(r197543): Use-after-free on storage/indexeddb/transaction-abort-private.html
https://bugs.webkit.org/show_bug.cgi?id=155067

Reviewed by Filip Pizlo.

GCIncommingRefCountedSets need to be finalized before we start
destructing members of the Heap object. Previously, we would
clear all our ArrayBuffer objects when the GCIncommingRefCountedSet
holding them was destroyed. However, ArrayBuffers have a weak
reference to their wrappers. When we would attempt to destroy the
ArrayBuffer object we would end up accessing the WeakImpl for
the weak reference, which had already been freed as we destroyed
our weak block. The solution to this is to move the old
GCIncommingRefCountedSet destructor functionality to a new
function lastChanceToFinalize. This function is called when
we finalize our other objects on Heap destruction.

* heap/GCIncomingRefCountedSet.h:
* heap/GCIncomingRefCountedSetInlines.h:
(JSC::GCIncomingRefCountedSet<T>::lastChanceToFinalize):
(JSC::GCIncomingRefCountedSet<T>::~GCIncomingRefCountedSet): Deleted.
* heap/Heap.cpp:
(JSC::Heap::lastChanceToFinalize):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (198564 => 198565)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-23 00:12:23 UTC (rev 198564)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-23 00:19:47 UTC (rev 198565)
@@ -1,3 +1,29 @@
+2016-03-22  Keith Miller  <[email protected]>
+
+        REGRESSION(r197543): Use-after-free on storage/indexeddb/transaction-abort-private.html
+        https://bugs.webkit.org/show_bug.cgi?id=155067
+
+        Reviewed by Filip Pizlo.
+
+        GCIncommingRefCountedSets need to be finalized before we start
+        destructing members of the Heap object. Previously, we would
+        clear all our ArrayBuffer objects when the GCIncommingRefCountedSet
+        holding them was destroyed. However, ArrayBuffers have a weak
+        reference to their wrappers. When we would attempt to destroy the
+        ArrayBuffer object we would end up accessing the WeakImpl for
+        the weak reference, which had already been freed as we destroyed
+        our weak block. The solution to this is to move the old
+        GCIncommingRefCountedSet destructor functionality to a new
+        function lastChanceToFinalize. This function is called when
+        we finalize our other objects on Heap destruction.
+
+        * heap/GCIncomingRefCountedSet.h:
+        * heap/GCIncomingRefCountedSetInlines.h:
+        (JSC::GCIncomingRefCountedSet<T>::lastChanceToFinalize):
+        (JSC::GCIncomingRefCountedSet<T>::~GCIncomingRefCountedSet): Deleted.
+        * heap/Heap.cpp:
+        (JSC::Heap::lastChanceToFinalize):
+
 2016-03-22  Per Arne Vollan  <[email protected]>
 
         [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround

Modified: trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSet.h (198564 => 198565)


--- trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSet.h	2016-03-23 00:12:23 UTC (rev 198564)
+++ trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSet.h	2016-03-23 00:19:47 UTC (rev 198565)
@@ -36,8 +36,9 @@
 class GCIncomingRefCountedSet {
 public:
     GCIncomingRefCountedSet();
-    ~GCIncomingRefCountedSet();
-    
+
+    void lastChanceToFinalize();
+
     // Returns true if the native object is new to this set.
     bool addReference(JSCell*, T*);
     

Modified: trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSetInlines.h (198564 => 198565)


--- trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSetInlines.h	2016-03-23 00:12:23 UTC (rev 198564)
+++ trunk/Source/_javascript_Core/heap/GCIncomingRefCountedSetInlines.h	2016-03-23 00:19:47 UTC (rev 198565)
@@ -38,7 +38,7 @@
 }
 
 template<typename T>
-GCIncomingRefCountedSet<T>::~GCIncomingRefCountedSet()
+void GCIncomingRefCountedSet<T>::lastChanceToFinalize()
 {
     for (size_t i = m_vector.size(); i--;)
         m_vector[i]->filterIncomingReferences(removeAll);

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (198564 => 198565)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2016-03-23 00:12:23 UTC (rev 198564)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2016-03-23 00:19:47 UTC (rev 198565)
@@ -382,6 +382,7 @@
     RELEASE_ASSERT(!m_vm->entryScope);
     RELEASE_ASSERT(m_operationInProgress == NoOperation);
 
+    m_arrayBuffers.lastChanceToFinalize();
     m_codeBlocks.lastChanceToFinalize();
     m_objectSpace.lastChanceToFinalize();
     releaseDelayedReleasedObjects();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to