Title: [229555] branches/safari-605-branch/Source/WebKit
Revision
229555
Author
jmarc...@apple.com
Date
2018-03-12 14:59:34 -0700 (Mon, 12 Mar 2018)

Log Message

Cherry-pick r229134. rdar://problem/38035474

Modified Paths

Diff

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (229554 => 229555)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-03-12 21:59:32 UTC (rev 229554)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-03-12 21:59:34 UTC (rev 229555)
@@ -1,5 +1,28 @@
 2018-03-11  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r229134. rdar://problem/38035474
+
+    2018-03-01  Antti Koivisto  <an...@apple.com>
+
+            Crash when updating cache entry after validation in apps that uses class A file protection
+            https://bugs.webkit.org/show_bug.cgi?id=183242
+            <rdar://problem/33289058>
+
+            Reviewed by Chris Dumez.
+
+            When validating a cache entry, we keep it alive until we get a network response. With 304 response
+            we then update the headers of this existing entry. This accesses the body data of the entry which
+            may be backed by a mapped file. If the app uses class A protection, user might have locked
+            the device and the entry might have become inaccessible, leading to a crash.
+
+            * NetworkProcess/cache/NetworkCacheEntry.cpp:
+            (WebKit::NetworkCache::Entry::setNeedsValidation):
+
+            In case of class A protection, pull the data to a memory buffer immediately before starting a revalidation request.
+            This makes the window where the file could become inaccessible much shorter (since it no longer depends on network).
+
+2018-03-11  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r229028. rdar://problem/37992284
 
     2018-02-26  Youenn Fablet  <you...@apple.com>

Modified: branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp (229554 => 229555)


--- branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp	2018-03-12 21:59:32 UTC (rev 229554)
+++ branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp	2018-03-12 21:59:34 UTC (rev 229555)
@@ -195,6 +195,13 @@
 
 void Entry::setNeedsValidation(bool value)
 {
+    if (value) {
+        // Validation keeps the entry alive waiting for the network response. Pull data from a mapped file into a buffer early
+        // to protect against map disappearing due to device becoming locked.
+        // FIXME: Cache files should be Class B/C, or we shoudn't use mapped files at all in these cases.
+        if (!NetworkProcess::singleton().cache()->canUseSharedMemoryForBodyData())
+            buffer();
+    }
     m_response.setSource(value ? WebCore::ResourceResponse::Source::DiskCacheAfterValidation : WebCore::ResourceResponse::Source::DiskCache);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to