Skip to content

Commit

Permalink
Only block IOKit in sandbox if UI side compositing is enabled
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255683
<rdar://problem/108224554>

Reviewed by Tim Horton.

Only block IOKit in sandbox if UI side compositing is enabled. The UI side compositing flag is currently not being checked.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::shouldBlockIOKit):
(WebKit::WebPageProxy::creationParameters):

Canonical link: https://commits.webkit.org/263160@main
  • Loading branch information
pvollan committed Apr 20, 2023
1 parent 4cf2bc3 commit 13feb81
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Source/WebKit/UIProcess/WebPageProxy.cpp
Expand Up @@ -8938,15 +8938,16 @@ static Span<const ASCIILiteral> gpuMachServices()
#endif // PLATFORM(COCOA)

#if PLATFORM(COCOA) && !ENABLE(WEBCONTENT_GPU_SANDBOX_EXTENSIONS_BLOCKING) || HAVE(MACH_BOOTSTRAP_EXTENSION)
static bool shouldBlockIOKit(const WebPreferences& preferences)
static bool shouldBlockIOKit(const WebPreferences& preferences, DrawingAreaType drawingAreaType)
{
if (!preferences.useGPUProcessForMediaEnabled()
|| (!preferences.captureVideoInGPUProcessEnabled() && !preferences.captureVideoInUIProcessEnabled())
|| (!preferences.captureAudioInGPUProcessEnabled() && !preferences.captureAudioInUIProcessEnabled())
|| !preferences.webRTCPlatformCodecsInGPUProcessEnabled()
|| !preferences.useGPUProcessForCanvasRenderingEnabled()
|| !preferences.useGPUProcessForDOMRenderingEnabled()
|| !preferences.useGPUProcessForWebGLEnabled())
|| !preferences.useGPUProcessForWebGLEnabled()
|| drawingAreaType != DrawingAreaType::RemoteLayerTree)
return false;
return true;
}
Expand Down Expand Up @@ -9049,7 +9050,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
parameters.additionalSupportedImageTypes = m_configuration->additionalSupportedImageTypes();

#if !ENABLE(WEBCONTENT_GPU_SANDBOX_EXTENSIONS_BLOCKING)
if (!shouldBlockIOKit(preferences())) {
if (!shouldBlockIOKit(preferences(), drawingArea.type())) {
parameters.gpuIOKitExtensionHandles = SandboxExtension::createHandlesForIOKitClassExtensions(gpuIOKitClasses(), std::nullopt);
parameters.gpuMachExtensionHandles = SandboxExtension::createHandlesForMachLookup(gpuMachServices(), std::nullopt);
}
Expand Down Expand Up @@ -9191,7 +9192,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
#else
bool createBootstrapExtension = !parameters.store.getBoolValueForKey(WebPreferencesKey::experimentalSandboxEnabledKey());
#endif
if (!shouldBlockIOKit(preferences()) || createBootstrapExtension)
if (!shouldBlockIOKit(preferences(), drawingArea.type()) || createBootstrapExtension)
parameters.machBootstrapHandle = SandboxExtension::createHandleForMachBootstrapExtension();
#endif
return parameters;
Expand Down

0 comments on commit 13feb81

Please sign in to comment.