Changeset 253127 in webkit


Ignore:
Timestamp:
Dec 4, 2019 4:07:39 PM (4 years ago)
Author:
pvollan@apple.com
Message:

[iOS] The UI process should issue mach sandbox extension to "com.apple.AGXCompilerService"
https://bugs.webkit.org/show_bug.cgi?id=203915

Reviewed by Brent Fulgham.

Only a few iPad models need access to "com.apple.AGXCompilerService” in the WebContent process.
The UI process should issue this mach extension for these iPad models.

  • Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):

  • Shared/WebProcessCreationParameters.h:
  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::deviceHasAGXCompilerService):
(WebKit::WebProcessPool::platformInitializeWebProcess):

  • WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::WebProcess::platformInitializeWebProcess):

Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r253118 r253127  
     12019-12-04  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] The UI process should issue mach sandbox extension to "com.apple.AGXCompilerService"
     4        https://bugs.webkit.org/show_bug.cgi?id=203915
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Only a few iPad models need access to "com.apple.AGXCompilerService” in the WebContent process.
     9        The UI process should issue this mach extension for these iPad models.
     10 
     11        * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
     12        * Shared/WebProcessCreationParameters.cpp:
     13        (WebKit::WebProcessCreationParameters::encode const):
     14        (WebKit::WebProcessCreationParameters::decode):
     15        * Shared/WebProcessCreationParameters.h:
     16        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     17        (WebKit::deviceHasAGXCompilerService):
     18        (WebKit::WebProcessPool::platformInitializeWebProcess):
     19        * WebProcess/cocoa/WebProcessCocoa.mm:
     20        (WebKit::WebProcess::platformInitializeWebProcess):
     21
    1222019-12-04  Kate Cheney  <katherine_cheney@apple.com>
    223
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb

    r253011 r253127  
    286286           (sysctl-name #"kern.bootsessionuuid"))
    287287
     288    (allow mach-lookup (with report) (with telemetry)
     289        (xpc-service-name-prefix "com.apple.AGXCompilerService"))
     290
    288291    (allow mach-lookup
    289        (xpc-service-name-prefix "com.apple.AGXCompilerService")
    290292       ;; <rdar://problem/47268166>
    291293       (xpc-service-name "com.apple.MTLCompilerService"))
     
    965967    (require-all
    966968        (extension "com.apple.webkit.extension.mach")
    967         (global-name "com.apple.iphone.axserver-systemwide" "com.apple.tccd")))
     969        (global-name "com.apple.iphone.axserver-systemwide" "com.apple.tccd" "com.apple.AGXCompilerService")))
    968970
    969971(media-capture-support)
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r251121 r253127  
    159159
    160160    encoder << websiteDataStoreParameters;
     161   
     162#if PLATFORM(IOS)
     163    encoder << compilerServiceExtensionHandle;
     164#endif
    161165}
    162166
     
    389393    parameters.websiteDataStoreParameters = WTFMove(*websiteDataStoreParameters);
    390394
     395#if PLATFORM(IOS)
     396    Optional<Optional<SandboxExtension::Handle>> compilerServiceExtensionHandle;
     397    decoder >> compilerServiceExtensionHandle;
     398    if (!compilerServiceExtensionHandle)
     399        return false;
     400    parameters.compilerServiceExtensionHandle = WTFMove(*compilerServiceExtensionHandle);
     401#endif
     402
    391403    return true;
    392404}
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r251121 r253127  
    197197
    198198    Optional<WebProcessDataStoreParameters> websiteDataStoreParameters;
     199   
     200#if PLATFORM(IOS)
     201    Optional<SandboxExtension::Handle> compilerServiceExtensionHandle;
     202#endif
    199203};
    200204
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r252368 r253127  
    6969#endif
    7070
     71#if PLATFORM(IOS)
     72#import <sys/utsname.h>
     73#endif
     74
    7175NSString *WebServiceWorkerRegistrationDirectoryDefaultsKey = @"WebServiceWorkerRegistrationDirectory";
    7276NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
     
    167171#endif
    168172}
     173
     174#if PLATFORM(IOS)
     175static bool deviceHasAGXCompilerService()
     176{
     177    static bool deviceHasAGXCompilerService = false;
     178    static std::once_flag flag;
     179    std::call_once(
     180        flag,
     181        [] () {
     182            struct utsname systemInfo;
     183            if (uname(&systemInfo))
     184                return;
     185            const char* machine = systemInfo.machine;
     186            if (!strcmp(machine, "iPad5,1") || !strcmp(machine, "iPad5,2") || !strcmp(machine, "iPad5,3") || !strcmp(machine, "iPad5,4"))
     187                deviceHasAGXCompilerService = true;
     188        });
     189    return deviceHasAGXCompilerService;
     190}
     191#endif
    169192
    170193void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process, WebProcessCreationParameters& parameters)
     
    264287    parameters.screenProperties = WTFMove(screenProperties);
    265288    parameters.useOverlayScrollbars = ([NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay);
     289#endif
     290   
     291#if PLATFORM(IOS)
     292    if (deviceHasAGXCompilerService()) {
     293        SandboxExtension::Handle compilerServiceExtensionHandle;
     294        SandboxExtension::createHandleForMachLookup("com.apple.AGXCompilerService", WTF::nullopt, compilerServiceExtensionHandle);
     295        parameters.compilerServiceExtensionHandle = WTFMove(compilerServiceExtensionHandle);
     296    }
    266297#endif
    267298}
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r252712 r253127  
    222222#endif
    223223#endif
     224   
     225#if PLATFORM(IOS)
     226    if (parameters.compilerServiceExtensionHandle)
     227        SandboxExtension::consumePermanently(*parameters.compilerServiceExtensionHandle);
     228#endif
    224229}
    225230
Note: See TracChangeset for help on using the changeset viewer.