Bug 197390 - Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen
Summary: Add assertion to check whether shm files have maximum FileProtection of Compl...
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: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-29 15:11 PDT by Sihui Liu
Modified: 2021-02-17 11:24 PST (History)
11 users (show)

See Also:


Attachments
Patch (13.18 KB, patch)
2019-04-29 15:29 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2019-04-29 15:11:27 PDT
We have seen crashes where process gets killed because it tries accessing shm file after device is locked. We are suspecting this is because database protection class of shm file is set to be Complete by apps after it's created with lower protection level.
Comment 1 Sihui Liu 2019-04-29 15:15:08 PDT
<rdar://problem/42685773>
Comment 2 Sihui Liu 2019-04-29 15:29:23 PDT
Created attachment 368502 [details]
Patch
Comment 3 Alex Christensen 2019-04-29 16:16:51 PDT
Comment on attachment 368502 [details]
Patch

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

> Source/WebCore/platform/sql/SQLiteDatabase.cpp:154
> +        RELEASE_ASSERT(FileSystem::isSafeToUseMemoryMapForPath(shmFileName));

Why not just call makeSafeToUseMemoryMapForPath?
Comment 4 Sihui Liu 2019-04-29 17:48:55 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 368502 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=368502&action=review
> 
> > Source/WebCore/platform/sql/SQLiteDatabase.cpp:154
> > +        RELEASE_ASSERT(FileSystem::isSafeToUseMemoryMapForPath(shmFileName));
> 
> Why not just call makeSafeToUseMemoryMapForPath?

If the crash is caused by the shm file being unsafe for mmap, we probably need change in sqlite instead of WebKit to ensure shm file is in correct protection class when the file is being used.
Comment 5 Geoffrey Garen 2019-05-02 13:23:43 PDT
Comment on attachment 368502 [details]
Patch

r=me
Comment 6 WebKit Commit Bot 2019-05-03 14:24:11 PDT
Comment on attachment 368502 [details]
Patch

Clearing flags on attachment: 368502

Committed r244921: <https://trac.webkit.org/changeset/244921>
Comment 7 WebKit Commit Bot 2019-05-03 14:24:13 PDT
All reviewed patches have been landed.  Closing bug.