Bug 208146 - [iOS] Issue mach sandbox extensions to the WebContent process for a set of specific services
Summary: [iOS] Issue mach sandbox extensions to the WebContent process for a set of sp...
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: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-24 10:50 PST by Per Arne Vollan
Modified: 2020-02-27 18:44 PST (History)
4 users (show)

See Also:


Attachments
Patch (14.80 KB, patch)
2020-02-24 11:05 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (11.22 KB, patch)
2020-02-24 15:27 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (11.21 KB, patch)
2020-02-27 09:32 PST, Per Arne Vollan
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Patch (11.21 KB, patch)
2020-02-27 10:03 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (11.58 KB, patch)
2020-02-27 18:07 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2020-02-24 10:50:49 PST
We are still seeing some accesses from the WebContent process to a small set of services. Since we do not currently have backtraces for these accesses, make a speculative patch, where we issue these extension for all apps except Safari.
Comment 1 Per Arne Vollan 2020-02-24 11:05:05 PST
Created attachment 391559 [details]
Patch
Comment 2 Brent Fulgham 2020-02-24 13:24:10 PST
Comment on attachment 391559 [details]
Patch

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

This patch seems to be having build issues. Is this the patch you meant to upload?

> Source/WebKit/Shared/WebProcessCreationParameters.cpp:464
> +    parameters.frontboardServicesExtensionHandle = WTFMove(*frontboardServicesExtensionHandle);

I think your life would be easier if you switched to a SandboxExtension::HandleArray for these items.

> Source/WebKit/Shared/WebProcessCreationParameters.h:212
> +    Optional<SandboxExtension::Handle> frontboardServicesExtensionHandle;

I think it makes sense to have individual extension handles for things we turn on and off dynamically (like camera/microphone, perhaps), but for things that are based on the linked application we should probably just add them as strings in the WebProcessProxy, and serialize them all in a single SandboxExtension::HandleArray.

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:365
> +        SandboxExtension::createHandleForMachLookup("com.apple.AGXCompilerService", WTF::nullopt, parameters.compilerServiceExtensionHandle);

Much tidier! :-)

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:374
> +        SandboxExtension::createHandleForMachLookup("com.apple.frontboard.systemappservices", WTF::nullopt, parameters.frontboardServicesExtensionHandle);

I think these could make sense as a single SandboxExtension::HandleArray.
Comment 3 Per Arne Vollan 2020-02-24 13:39:01 PST
(In reply to Brent Fulgham from comment #2)
> Comment on attachment 391559 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=391559&action=review
> 
> This patch seems to be having build issues. Is this the patch you meant to
> upload?
> 
> > Source/WebKit/Shared/WebProcessCreationParameters.cpp:464
> > +    parameters.frontboardServicesExtensionHandle = WTFMove(*frontboardServicesExtensionHandle);
> 
> I think your life would be easier if you switched to a
> SandboxExtension::HandleArray for these items.
> 
> > Source/WebKit/Shared/WebProcessCreationParameters.h:212
> > +    Optional<SandboxExtension::Handle> frontboardServicesExtensionHandle;
> 
> I think it makes sense to have individual extension handles for things we
> turn on and off dynamically (like camera/microphone, perhaps), but for
> things that are based on the linked application we should probably just add
> them as strings in the WebProcessProxy, and serialize them all in a single
> SandboxExtension::HandleArray.
> 
> > Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:365
> > +        SandboxExtension::createHandleForMachLookup("com.apple.AGXCompilerService", WTF::nullopt, parameters.compilerServiceExtensionHandle);
> 
> Much tidier! :-)
> 
> > Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:374
> > +        SandboxExtension::createHandleForMachLookup("com.apple.frontboard.systemappservices", WTF::nullopt, parameters.frontboardServicesExtensionHandle);
> 
> I think these could make sense as a single SandboxExtension::HandleArray.

I will change the patch to use HandleArray.

Thanks for reviewing!
Comment 4 Per Arne Vollan 2020-02-24 15:27:55 PST
Created attachment 391587 [details]
Patch
Comment 5 Brent Fulgham 2020-02-26 13:13:31 PST
Comment on attachment 391587 [details]
Patch

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

Very nice! r=me.

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:264
> +        SandboxExtension::consumePermanently(parameters.dynamicMachExtensionHandles[i]);

Someday we should make a proper iterator interface for SandboxExtension::HandleArray so we can use modern looping.
Comment 6 Per Arne Vollan 2020-02-26 13:15:09 PST
Comment on attachment 391587 [details]
Patch

Thanks for reviewing!
Comment 7 WebKit Commit Bot 2020-02-26 13:38:47 PST
Comment on attachment 391587 [details]
Patch

Clearing flags on attachment: 391587

Committed r257508: <https://trac.webkit.org/changeset/257508>
Comment 8 WebKit Commit Bot 2020-02-26 13:38:51 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2020-02-26 13:39:16 PST
<rdar://problem/59819320>
Comment 10 Jacob Uphoff 2020-02-26 16:47:16 PST
Reverted r257508 for reason:

This commit broke the watchos build

Committed r257534: <https://trac.webkit.org/changeset/257534>
Comment 11 Per Arne Vollan 2020-02-27 09:32:37 PST
Created attachment 391884 [details]
Patch
Comment 12 WebKit Commit Bot 2020-02-27 09:59:15 PST
Comment on attachment 391884 [details]
Patch

Rejecting attachment 391884 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 391884, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/13329981
Comment 13 Per Arne Vollan 2020-02-27 10:03:33 PST
Created attachment 391885 [details]
Patch
Comment 14 WebKit Commit Bot 2020-02-27 10:48:41 PST
Comment on attachment 391885 [details]
Patch

Clearing flags on attachment: 391885

Committed r257575: <https://trac.webkit.org/changeset/257575>
Comment 15 WebKit Commit Bot 2020-02-27 10:48:43 PST
All reviewed patches have been landed.  Closing bug.
Comment 16 Ryan Haddad 2020-02-27 15:39:31 PST
Reverted r257575 for reason:

Broke the watchOS build.

Committed r257593: <https://trac.webkit.org/changeset/257593>
Comment 17 Per Arne Vollan 2020-02-27 18:07:02 PST
Created attachment 391952 [details]
Patch
Comment 18 WebKit Commit Bot 2020-02-27 18:44:46 PST
Comment on attachment 391952 [details]
Patch

Clearing flags on attachment: 391952

Committed r257611: <https://trac.webkit.org/changeset/257611>
Comment 19 WebKit Commit Bot 2020-02-27 18:44:47 PST
All reviewed patches have been landed.  Closing bug.