Bug 197264 - Make NetworkCache blobs safe for mmap instead of not using blobs
Summary: Make NetworkCache blobs safe for mmap instead of not using blobs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-24 17:16 PDT by Alex Christensen
Modified: 2019-04-25 23:06 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.73 KB, patch)
2019-04-24 17:18 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (7.62 KB, patch)
2019-04-24 22:26 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (7.10 KB, patch)
2019-04-25 10:22 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2019-04-24 17:16:42 PDT
Make NetworkCache blobs safe for mmap instead of not using blobs
Comment 1 Alex Christensen 2019-04-24 17:18:49 PDT
Created attachment 368203 [details]
Patch
Comment 2 Alex Christensen 2019-04-24 22:26:57 PDT
Created attachment 368213 [details]
Patch
Comment 3 Antti Koivisto 2019-04-25 00:38:06 PDT
Comment on attachment 368213 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=368213&action=review

Looks fine except the part where it doesn't build.

> Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp:97
> +    makeSafeToUseMemoryMapForPath(blobPathString);

Can't you do this after the existence test? Or do you specifically want to upgrade existing files?

> Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:-281
> -static size_t estimateRecordsSize(unsigned recordCount, unsigned blobCount)
> -{
> -    auto inlineBodyCount = recordCount - std::min(blobCount, recordCount);
> -    auto headerSizes = recordCount * 4096;
> -    auto inlineBodySizes = (maximumInlineBodySize / 2) * inlineBodyCount;
> -    return headerSizes + inlineBodySizes;
> -}

You can't delete this function!

> Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:315
>  

...because you call it here.
Comment 4 Alex Christensen 2019-04-25 10:21:27 PDT
Comment on attachment 368213 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=368213&action=review

>> Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp:97
>> +    makeSafeToUseMemoryMapForPath(blobPathString);
> 
> Can't you do this after the existence test? Or do you specifically want to upgrade existing files?

I want to "upgrade" existing files.  I don't think it matters if I do it before or after the call to access, but it needs to be before the call to mapFile.
Comment 5 Alex Christensen 2019-04-25 10:22:21 PDT
Created attachment 368243 [details]
Patch
Comment 6 WebKit Commit Bot 2019-04-25 23:06:15 PDT
Comment on attachment 368243 [details]
Patch

Clearing flags on attachment: 368243

Committed r244678: <https://trac.webkit.org/changeset/244678>
Comment 7 WebKit Commit Bot 2019-04-25 23:06:17 PDT
All reviewed patches have been landed.  Closing bug.