Bug 220595

Summary: [GPUP][iOS] Create sandbox extensions for cache and temp directory
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, bfulgham, cdumez, cmarcelo, ews-watchlist, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
cdumez: review+
Patch
none
Patch
ews-feeder: commit-queue-
Patch none

Description Per Arne Vollan 2021-01-13 09:53:02 PST
Create sandbox extensions for GPU process access to cache and temp directory.
Comment 1 Per Arne Vollan 2021-01-13 09:53:46 PST
<rdar://problem/72450307>
Comment 2 Per Arne Vollan 2021-01-13 09:57:07 PST
Created attachment 417544 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-01-13 10:01:16 PST
Comment on attachment 417544 [details]
Patch

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

> Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> +#if PLATFORM(IOS_FAMILY)
> +    encoder << containerCachesDirectoryExtensionHandle;
> +    encoder << containerTemporaryDirectoryExtensionHandle;
> +#endif

Why is this iOS only?
Comment 4 Chris Dumez 2021-01-13 10:03:16 PST
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 417544 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=417544&action=review
> 
> > Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> > +#if PLATFORM(IOS_FAMILY)
> > +    encoder << containerCachesDirectoryExtensionHandle;
> > +    encoder << containerTemporaryDirectoryExtensionHandle;
> > +#endif
> 
> Why is this iOS only?

When GPUProcess is disabled and we pass those to the WebProcess, the code is for IOS_FAMILY only too, so at least it is consistent.

The patch does not build on iOS EWS though.
Comment 5 Per Arne Vollan 2021-01-13 10:43:14 PST
Created attachment 417547 [details]
Patch
Comment 6 Per Arne Vollan 2021-01-13 10:54:32 PST
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 417544 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=417544&action=review
> 
> > Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> > +#if PLATFORM(IOS_FAMILY)
> > +    encoder << containerCachesDirectoryExtensionHandle;
> > +    encoder << containerTemporaryDirectoryExtensionHandle;
> > +#endif
> 
> Why is this iOS only?

This works a little different on macOS, where confstr is used in the UI process to determine the cache and temp directory. The cache and temp directories are then passed as sandbox parameters, and sandbox rules will allow access to these directories.

Thanks for reviewing!
Comment 7 Per Arne Vollan 2021-01-13 10:55:08 PST
(In reply to Chris Dumez from comment #4)
> (In reply to Simon Fraser (smfr) from comment #3)
> > Comment on attachment 417544 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=417544&action=review
> > 
> > > Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> > > +#if PLATFORM(IOS_FAMILY)
> > > +    encoder << containerCachesDirectoryExtensionHandle;
> > > +    encoder << containerTemporaryDirectoryExtensionHandle;
> > > +#endif
> > 
> > Why is this iOS only?
> 
> When GPUProcess is disabled and we pass those to the WebProcess, the code is
> for IOS_FAMILY only too, so at least it is consistent.
> 
> The patch does not build on iOS EWS though.

Should be fixed in latest patch.

Thanks for reviewing!
Comment 8 Simon Fraser (smfr) 2021-01-13 11:03:25 PST
(In reply to Per Arne Vollan from comment #6)
> (In reply to Simon Fraser (smfr) from comment #3)
> > Comment on attachment 417544 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=417544&action=review
> > 
> > > Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> > > +#if PLATFORM(IOS_FAMILY)
> > > +    encoder << containerCachesDirectoryExtensionHandle;
> > > +    encoder << containerTemporaryDirectoryExtensionHandle;
> > > +#endif
> > 
> > Why is this iOS only?
> 
> This works a little different on macOS, where confstr is used in the UI
> process to determine the cache and temp directory. The cache and temp
> directories are then passed as sandbox parameters, and sandbox rules will
> allow access to these directories.

It would be nicer to use a HAVE_FOO or USE_FOO macro then. We should avoid sprinkling platform #ifdefs around.
Comment 9 Per Arne Vollan 2021-01-13 11:11:22 PST
(In reply to Simon Fraser (smfr) from comment #8)
> (In reply to Per Arne Vollan from comment #6)
> > (In reply to Simon Fraser (smfr) from comment #3)
> > > Comment on attachment 417544 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=417544&action=review
> > > 
> > > > Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp:57
> > > > +#if PLATFORM(IOS_FAMILY)
> > > > +    encoder << containerCachesDirectoryExtensionHandle;
> > > > +    encoder << containerTemporaryDirectoryExtensionHandle;
> > > > +#endif
> > > 
> > > Why is this iOS only?
> > 
> > This works a little different on macOS, where confstr is used in the UI
> > process to determine the cache and temp directory. The cache and temp
> > directories are then passed as sandbox parameters, and sandbox rules will
> > allow access to these directories.
> 
> It would be nicer to use a HAVE_FOO or USE_FOO macro then. We should avoid
> sprinkling platform #ifdefs around.

Sounds good, I will use a USE macro!
Comment 10 Per Arne Vollan 2021-01-13 14:10:32 PST
Created attachment 417564 [details]
Patch
Comment 11 Per Arne Vollan 2021-01-14 06:02:37 PST
Created attachment 417612 [details]
Patch
Comment 12 Per Arne Vollan 2021-01-14 06:25:46 PST
Created attachment 417614 [details]
Patch
Comment 13 EWS 2021-01-14 07:31:23 PST
Committed r271482: <https://trac.webkit.org/changeset/271482>

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