RESOLVED FIXED Bug 214965
[iOS] Issue a temporary extension to the MobileGestalt daemon when the MobileGestalt cache is invalid
https://bugs.webkit.org/show_bug.cgi?id=214965
Summary [iOS] Issue a temporary extension to the MobileGestalt daemon when the Mobile...
Per Arne Vollan
Reported 2020-07-30 07:01:44 PDT
When the MobileGestalt cache is invalid, some MG queries will fail in the WebContent process, since it has no access to the daemon. This can be fixed by issuing a temporary extension to the daemon, and having the WebContent process query all relevant MG values while holding the extension. This will bring the values into the in-memory cache, which will be valid after the extension to the daemon has been revoked.
Attachments
Patch (6.87 KB, patch)
2020-07-30 07:17 PDT, Per Arne Vollan
no flags
Patch (8.00 KB, patch)
2020-07-30 09:59 PDT, Per Arne Vollan
no flags
Patch (8.41 KB, patch)
2020-07-30 10:04 PDT, Per Arne Vollan
no flags
Patch (8.40 KB, patch)
2020-07-30 10:19 PDT, Per Arne Vollan
no flags
Patch (8.12 KB, patch)
2020-07-30 13:05 PDT, Per Arne Vollan
ggaren: review+
Patch (8.10 KB, patch)
2020-07-30 14:10 PDT, Per Arne Vollan
no flags
Patch (9.55 KB, patch)
2020-07-31 06:36 PDT, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2020-07-30 07:17:05 PDT
Per Arne Vollan
Comment 2 2020-07-30 09:59:45 PDT
Per Arne Vollan
Comment 3 2020-07-30 10:04:05 PDT
Per Arne Vollan
Comment 4 2020-07-30 10:19:02 PDT
Geoffrey Garen
Comment 5 2020-07-30 10:55:20 PDT
Comment on attachment 405587 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405587&action=review > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 > +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) Does this code need to be platform conditional? If it doesn't need to be platform conditional, I'd suggest making it unconditional. From the perspective of the WebContent process, it's a better separation of concerns to honor the sandbox extension whenever it is present, regardless of why the UI process issued it. For one thing, the alternative risks issuing an extension and never revoking it!
Per Arne Vollan
Comment 6 2020-07-30 12:06:05 PDT
(In reply to Geoffrey Garen from comment #5) > Comment on attachment 405587 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405587&action=review > > > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 > > +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) > > Does this code need to be platform conditional? If it doesn't need to be > platform conditional, I'd suggest making it unconditional. > > From the perspective of the WebContent process, it's a better separation of > concerns to honor the sandbox extension whenever it is present, regardless > of why the UI process issued it. For one thing, the alternative risks > issuing an extension and never revoking it! That's a good point. In this case, I think this is only relevant on iOS, watchOS, and tvOS, since I believe MobileGestalt is not present elsewhere. Thanks for reviewing!
Geoffrey Garen
Comment 7 2020-07-30 12:10:44 PDT
Comment on attachment 405587 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405587&action=review >>> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 >>> +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) >> >> Does this code need to be platform conditional? If it doesn't need to be platform conditional, I'd suggest making it unconditional. >> >> From the perspective of the WebContent process, it's a better separation of concerns to honor the sandbox extension whenever it is present, regardless of why the UI process issued it. For one thing, the alternative risks issuing an extension and never revoking it! > > That's a good point. In this case, I think this is only relevant on iOS, watchOS, and tvOS, since I believe MobileGestalt is not present elsewhere. > > Thanks for reviewing! How about if we make the calls to MG conditional on platform, but we make the check and consumption of the extension handle cross-platform (by tightening the scope of the #if)?
Per Arne Vollan
Comment 8 2020-07-30 12:34:20 PDT
(In reply to Geoffrey Garen from comment #7) > Comment on attachment 405587 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405587&action=review > > >>> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 > >>> +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) > >> > >> Does this code need to be platform conditional? If it doesn't need to be platform conditional, I'd suggest making it unconditional. > >> > >> From the perspective of the WebContent process, it's a better separation of concerns to honor the sandbox extension whenever it is present, regardless of why the UI process issued it. For one thing, the alternative risks issuing an extension and never revoking it! > > > > That's a good point. In this case, I think this is only relevant on iOS, watchOS, and tvOS, since I believe MobileGestalt is not present elsewhere. > > > > Thanks for reviewing! > > How about if we make the calls to MG conditional on platform, but we make > the check and consumption of the extension handle cross-platform (by > tightening the scope of the #if)? Sounds good, will fix! Thanks for reviewing!
Per Arne Vollan
Comment 9 2020-07-30 13:05:05 PDT
Geoffrey Garen
Comment 10 2020-07-30 13:37:00 PDT
Comment on attachment 405600 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405600&action=review r=me > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 > + auto extension = SandboxExtension::create(WTFMove(*parameters.mobileGestaltExtensionHandle)); > + if (extension) { You can merge these two lines as "if (auto extension = ....)".
Per Arne Vollan
Comment 11 2020-07-30 13:40:14 PDT
(In reply to Geoffrey Garen from comment #10) > Comment on attachment 405600 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405600&action=review > > r=me > > > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:206 > > + auto extension = SandboxExtension::create(WTFMove(*parameters.mobileGestaltExtensionHandle)); > > + if (extension) { > > You can merge these two lines as "if (auto extension = ....)". Great, will do! Thank you!
Per Arne Vollan
Comment 12 2020-07-30 14:00:57 PDT
Per Arne Vollan
Comment 13 2020-07-30 14:10:52 PDT
Per Arne Vollan
Comment 14 2020-07-31 06:36:32 PDT
EWS
Comment 15 2020-07-31 07:03:39 PDT
Committed r265139: <https://trac.webkit.org/changeset/265139> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405685 [details].
Darin Adler
Comment 16 2020-08-04 14:26:34 PDT
Comment on attachment 405600 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405600&action=review > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:209 > +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) This needs a comment. I believe it’s trying to ask all the questions that need correct answers from everything that runs inside the sandbox. The comment should say what should and should not be on the list and how it was generated. I often discourage comments that say *what* something is doing, but we really need comments that say *why*!
Per Arne Vollan
Comment 17 2020-08-04 15:43:47 PDT
(In reply to Darin Adler from comment #16) > Comment on attachment 405600 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405600&action=review > > > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:209 > > +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) > > This needs a comment. I believe it’s trying to ask all the questions that > need correct answers from everything that runs inside the sandbox. The > comment should say what should and should not be on the list and how it was > generated. > > I often discourage comments that say *what* something is doing, but we > really need comments that say *why*! That is a good point. I will add a comment to this code. Thanks for reviewing!
Per Arne Vollan
Comment 18 2020-08-04 16:13:07 PDT
(In reply to Darin Adler from comment #16) > Comment on attachment 405600 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405600&action=review > > > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:209 > > +#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST) > > This needs a comment. I believe it’s trying to ask all the questions that > need correct answers from everything that runs inside the sandbox. The > comment should say what should and should not be on the list and how it was > generated. > > I often discourage comments that say *what* something is doing, but we > really need comments that say *why*! Added comment in <https://trac.webkit.org/changeset/265267/webkit>.
Note You need to log in before you can comment on or make changes to this bug.