Bug 213357 - [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle
Summary: [iOS, macOS] Allow access to the container manager to support Mail InjectedBu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-18 15:19 PDT by Brent Fulgham
Modified: 2020-06-20 16:36 PDT (History)
4 users (show)

See Also:


Attachments
Patch (6.61 KB, patch)
2020-06-18 15:22 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (7.01 KB, patch)
2020-06-18 15:28 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch for landing (7.75 KB, patch)
2020-06-19 13:45 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Catalina crash log (57.48 KB, text/plain)
2020-06-19 17:51 PDT, Ryan Haddad
no flags Details
Patch (7.80 KB, patch)
2020-06-20 12:19 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2020-06-18 15:19:12 PDT
The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need this access for web browsing, and should limit this access to this one case.

This patch creates a dynamic mach extension to the container manager for this single use case.
Comment 1 Brent Fulgham 2020-06-18 15:20:15 PDT
<rdar://problem/63837247>
Comment 2 Brent Fulgham 2020-06-18 15:22:06 PDT
Created attachment 402240 [details]
Patch
Comment 3 Brent Fulgham 2020-06-18 15:28:37 PDT
Created attachment 402242 [details]
Patch
Comment 4 Darin Adler 2020-06-18 16:13:56 PDT
Comment on attachment 402242 [details]
Patch

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

Is there any more scalable way to do this? Seems unfortunate to hardcode a client app bundle ID again.

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:299
> +#else

How about this instead?

#elif PLATFORM(IOS)
    return WebCore::IOSApplication::isMobileMail()
#else
    return false;
#endif
Comment 5 David Kilzer (:ddkilzer) 2020-06-19 02:32:51 PDT
Comment on attachment 402242 [details]
Patch

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

>> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:299
>> +#else
> 
> How about this instead?
> 
> #elif PLATFORM(IOS)
>     return WebCore::IOSApplication::isMobileMail()
> #else
>     return false;
> #endif

The problem is that it’s not just MobileMail that needs access.  We see other apps that use the WebContent process and talk to containermanagerd as well.

This only fixes the majority of cases, but not all of them.
Comment 6 Brent Fulgham 2020-06-19 13:44:24 PDT
Comment on attachment 402242 [details]
Patch

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

>>> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:299
>>> +#else
>> 
>> How about this instead?
>> 
>> #elif PLATFORM(IOS)
>>     return WebCore::IOSApplication::isMobileMail()
>> #else
>>     return false;
>> #endif
> 
> The problem is that it’s not just MobileMail that needs access.  We see other apps that use the WebContent process and talk to containermanagerd as well.
> 
> This only fixes the majority of cases, but not all of them.

Darin: Will do!

David: I'll add telemetry-backtrace so we get a backtrace if this is hit by anyone else. I'm very interested to see how that's possible.
Comment 7 Brent Fulgham 2020-06-19 13:45:31 PDT
Created attachment 402319 [details]
Patch for landing
Comment 8 EWS 2020-06-19 14:12:20 PDT
Committed r263287: <https://trac.webkit.org/changeset/263287>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402319 [details].
Comment 9 Ryan Haddad 2020-06-19 17:51:32 PDT
This change caused testing to exit early on Catalina due to crashes:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebKit              	0x0000000104e58d95 WebKit::AuxiliaryProcess::initializeSandbox(WebKit::AuxiliaryProcessInitializationParameters const&, WebKit::SandboxInitializationParameters&) + 6783 (AuxiliaryProcessMac.mm:693)
1   com.apple.WebKit              	0x00000001050fcdb0 WebKit::WebProcess::initializeSandbox(WebKit::AuxiliaryProcessInitializationParameters const&, WebKit::SandboxInitializationParameters&) + 196 (WebProcessCocoa.mm:589)
2   com.apple.WebKit              	0x0000000104c8e1ff WebKit::AuxiliaryProcess::initialize(WebKit::AuxiliaryProcessInitializationParameters const&) + 103
3   com.apple.WebKit              	0x000000010506cab9 void WebKit::XPCServiceInitializer<WebKit::WebProcess, WebKit::XPCServiceInitializerDelegate>(WTF::OSObjectPtr<NSObject<OS_xpc_object>*>, NSObject<OS_xpc_object>*, NSObject<OS_xpc_object>*) + 645 (XPCServiceEntryPoint.h:135)
4   com.apple.WebKit              	0x000000010506c7fe WebContentServiceInitializer + 61 (WebContentServiceEntryPoint.mm:53)


https://build.webkit.org/builders/Apple-Catalina-Release-WK2-Tests/builds/6485
Comment 10 Ryan Haddad 2020-06-19 17:51:49 PDT
Created attachment 402363 [details]
Catalina crash log
Comment 11 Ryan Haddad 2020-06-19 18:08:18 PDT
Reverted in https://trac.webkit.org/changeset/263307/webkit
Comment 12 Brent Fulgham 2020-06-20 12:19:25 PDT
Created attachment 402397 [details]
Patch
Comment 13 EWS 2020-06-20 16:36:05 PDT
Committed r263320: <https://trac.webkit.org/changeset/263320>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402397 [details].