Title: [219739] trunk/Source/WebKit
- Revision
- 219739
- Author
- [email protected]
- Date
- 2017-07-21 13:40:13 -0700 (Fri, 21 Jul 2017)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (219738 => 219739)
--- trunk/Source/WebKit/ChangeLog 2017-07-21 20:38:21 UTC (rev 219738)
+++ trunk/Source/WebKit/ChangeLog 2017-07-21 20:40:13 UTC (rev 219739)
@@ -1,3 +1,22 @@
+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-21 Brady Eidson <[email protected]>
Get rid of WebCore IconDatabase code.
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (219738 => 219739)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-07-21 20:38:21 UTC (rev 219738)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-07-21 20:40:13 UTC (rev 219739)
@@ -281,7 +281,9 @@
{
ASSERT(RunLoop::isMain());
- includeTodayAsOperatingDateIfNecessary();
+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+ includeTodayAsOperatingDateIfNecessary();
+ });
if (m_parameters.shouldSubmitTelemetry)
submitTelemetry();
}
@@ -732,6 +734,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