Title: [219936] branches/safari-604-branch/Source/WebKit
Revision
219936
Author
[email protected]
Date
2017-07-26 02:52:25 -0700 (Wed, 26 Jul 2017)

Log Message

Cherry-pick r219739. rdar://problem/33523884

Modified Paths

Diff

Modified: branches/safari-604-branch/Source/WebKit/ChangeLog (219935 => 219936)


--- branches/safari-604-branch/Source/WebKit/ChangeLog	2017-07-26 09:52:23 UTC (rev 219935)
+++ branches/safari-604-branch/Source/WebKit/ChangeLog	2017-07-26 09:52:25 UTC (rev 219936)
@@ -1,5 +1,28 @@
 2017-07-26  Jason Marcell  <[email protected]>
 
+        Cherry-pick r219739. rdar://problem/33523884
+
+    2017-07-21  Chris Dumez  <[email protected]>
+
+            WebResourceLoadStatisticsStore::m_operatingDates is unsafely modified from several threads
+            https://bugs.webkit.org/show_bug.cgi?id=174721
+            <rdar://problem/33400343>
+
+            Reviewed by Brent Fulgham.
+
+            WebResourceLoadStatisticsStore::m_operatingDates is supposed to only be modified on
+            the background thread. However, WebResourceLoadStatisticsStore::performDailyTasks()
+            was mistakenly calling includeTodayAsOperatingDateIfNecessary() on the main thread,
+            which would modify m_operatingDates. This could lead to crashes such as the
+            one in <rdar://problem/33400343>, as the main thread may modify m_operatingDates
+            while we are interating over it on the background thread to save it to disk.
+
+            * UIProcess/WebResourceLoadStatisticsStore.cpp:
+            (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
+            (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
+
+2017-07-26  Jason Marcell  <[email protected]>
+
         Cherry-pick r219594. rdar://problem/33523357
 
     2017-07-17  Timothy Horton  <[email protected]>

Modified: branches/safari-604-branch/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (219935 => 219936)


--- branches/safari-604-branch/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-07-26 09:52:23 UTC (rev 219935)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-07-26 09:52:25 UTC (rev 219936)
@@ -273,7 +273,9 @@
 {
     ASSERT(RunLoop::isMain());
 
-    includeTodayAsOperatingDateIfNecessary();
+    m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+        includeTodayAsOperatingDateIfNecessary();
+    });
     if (m_parameters.shouldSubmitTelemetry)
         submitTelemetry();
 }
@@ -724,6 +726,8 @@
 
 void WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary()
 {
+    ASSERT(!RunLoop::isMain());
+
     auto today = OperatingDate::today();
     if (!m_operatingDates.isEmpty() && today <= m_operatingDates.last())
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to