Changeset 244921 in webkit
- Timestamp:
- May 3, 2019 2:24:06 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r244907 r244921 1 2019-05-03 Sihui Liu <sihui_liu@apple.com> 2 3 Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen 4 https://bugs.webkit.org/show_bug.cgi?id=197390 5 <rdar://problem/42685773> 6 7 Reviewed by Geoffrey Garen. 8 9 * wtf/FileSystem.cpp: 10 (WTF::FileSystemImpl::isSafeToUseMemoryMapForPath): 11 (WTF::FileSystemImpl::makeSafeToUseMemoryMapForPath): 12 * wtf/FileSystem.h: 13 * wtf/cocoa/FileSystemCocoa.mm: 14 (WTF::FileSystemImpl::isSafeToUseMemoryMapForPath): 15 (WTF::FileSystemImpl::makeSafeToUseMemoryMapForPath): 16 1 17 2019-05-03 Commit Queue <commit-queue@webkit.org> 2 18 -
trunk/Source/WTF/wtf/FileSystem.cpp
r240437 r244921 364 364 } 365 365 366 #if !PLATFORM(IOS_FAMILY) 367 bool isSafeToUseMemoryMapForPath(const String&) 368 { 369 return true; 370 } 371 372 void makeSafeToUseMemoryMapForPath(const String&) 373 { 374 } 375 #endif 376 366 377 } // namespace FileSystemImpl 367 378 } // namespace WTF -
trunk/Source/WTF/wtf/FileSystem.h
r240600 r244921 188 188 WTF_EXPORT_PRIVATE String realPath(const String&); 189 189 190 WTF_EXPORT_PRIVATE bool isSafeToUseMemoryMapForPath(const String&); 191 WTF_EXPORT_PRIVATE void makeSafeToUseMemoryMapForPath(const String&); 192 190 193 class MappedFileData { 191 194 public: -
trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm
r240437 r244921 140 140 } 141 141 142 #if PLATFORM(IOS_FAMILY) 143 bool isSafeToUseMemoryMapForPath(const String& path) 144 { 145 NSError *error = nil; 146 NSDictionary<NSFileAttributeKey, id> *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:&error]; 147 if (error) { 148 LOG_ERROR("Unable to get path protection class"); 149 return false; 150 } 151 if ([[attributes objectForKey:NSFileProtectionKey] isEqualToString:NSFileProtectionComplete]) { 152 LOG_ERROR("Path protection class is NSFileProtectionComplete, so it is not safe to use memory map"); 153 return false; 154 } 155 return true; 156 } 157 158 void makeSafeToUseMemoryMapForPath(const String& path) 159 { 160 if (isSafeToUseMemoryMapForPath(path)) 161 return; 162 163 NSError *error = nil; 164 BOOL success = [[NSFileManager defaultManager] setAttributes:@{ NSFileProtectionKey: NSFileProtectionCompleteUnlessOpen } ofItemAtPath:path error:&error]; 165 ASSERT(!error); 166 ASSERT_UNUSED(success, success); 167 } 168 #endif 169 142 170 } // namespace FileSystemImpl 143 171 } // namespace WTF -
trunk/Source/WebCore/ChangeLog
r244918 r244921 1 2019-05-03 Sihui Liu <sihui_liu@apple.com> 2 3 Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen 4 https://bugs.webkit.org/show_bug.cgi?id=197390 5 <rdar://problem/42685773> 6 7 Reviewed by Geoffrey Garen. 8 9 We have seen crashes about accessing database files after device is locked. We are suspecting this is because 10 shm files have wrong data protection class, but shm files should not have Complete class protection when it 11 is created. It is likely the protection class is changed later. Add an assertion to verify our guess. If the 12 crash signature changes after this patch, we probably need to change database implementation. If it is not, we 13 have other problem than data protection. 14 15 * platform/sql/SQLiteDatabase.cpp: 16 (WebCore::SQLiteDatabase::open): 17 1 18 2019-05-03 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp
r243939 r244921 149 149 if (openMode != OpenMode::ReadOnly) 150 150 useWALJournalMode(); 151 152 String shmFileName = makeString(filename, "-shm"_s); 153 if (FileSystem::fileExists(shmFileName)) 154 RELEASE_ASSERT(FileSystem::isSafeToUseMemoryMapForPath(shmFileName)); 151 155 152 156 return isOpen(); -
trunk/Source/WebKit/ChangeLog
r244920 r244921 1 2019-05-03 Sihui Liu <sihui_liu@apple.com> 2 3 Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen 4 https://bugs.webkit.org/show_bug.cgi?id=197390 5 <rdar://problem/42685773> 6 7 Reviewed by Geoffrey Garen. 8 9 Move data protection check to WebCore so it can be applied to database files. 10 11 * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: 12 (WebKit::NetworkCache::BlobStorage::add): 13 * NetworkProcess/cache/NetworkCacheFileSystem.cpp: 14 (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): Deleted. 15 * NetworkProcess/cache/NetworkCacheFileSystem.h: 16 * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Removed. 17 * SourcesCocoa.txt: 18 * UIProcess/API/APIContentRuleListStore.cpp: 19 (API::openAndMapOrCopyContentRuleList): 20 (API::compiledToFile): 21 1 22 2019-05-03 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp
r244678 r244921 95 95 96 96 String blobPathString = blobPathForHash(hash); 97 makeSafeToUseMemoryMapForPath(blobPathString);97 FileSystem::makeSafeToUseMemoryMapForPath(blobPathString); 98 98 99 99 auto blobPath = FileSystem::fileSystemRepresentation(blobPathString); -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp
r244678 r244921 146 146 } 147 147 148 #if !PLATFORM(IOS_FAMILY)149 void makeSafeToUseMemoryMapForPath(const String&)150 {151 }152 #endif153 154 148 } 155 149 } -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h
r244678 r244921 43 43 void updateFileModificationTimeIfNeeded(const String& path); 44 44 45 void makeSafeToUseMemoryMapForPath(const String&);46 47 45 } 48 46 } -
trunk/Source/WebKit/SourcesCocoa.txt
r244747 r244921 23 23 24 24 NetworkProcess/cache/NetworkCacheDataCocoa.mm 25 NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm26 25 NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm 27 26 -
trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp
r244597 r244921 209 209 static Optional<MappedData> openAndMapOrCopyContentRuleList(const WTF::String& path) 210 210 { 211 WebKit::NetworkCache::makeSafeToUseMemoryMapForPath(path);211 FileSystem::makeSafeToUseMemoryMapForPath(path); 212 212 WebKit::NetworkCache::Data fileData = mapFile(fileSystemRepresentation(path).data()); 213 213 if (fileData.isNull()) … … 387 387 } 388 388 389 makeSafeToUseMemoryMapForPath(finalFilePath);389 FileSystem::makeSafeToUseMemoryMapForPath(finalFilePath); 390 390 391 391 return {{ WTFMove(metaData), WTFMove(mappedData) }};
Note: See TracChangeset
for help on using the changeset viewer.