WebResourceLoadStatisticsStore::m_operatingDates is unsafely modified from several...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 20:40:13 +0000 (20:40 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 20:40:13 +0000 (20:40 +0000)
commitffb0b446b34e148d0251809f7cd4a42a5d6332f6
tree8140490025a311e9112053a7dce3ac6532bb061d
parent43cadb81dcc01e66674d8e5f08c4b1f909bf193f
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp