Title: [241169] trunk/Source
Revision
241169
Author
pvol...@apple.com
Date
2019-02-07 16:02:49 -0800 (Thu, 07 Feb 2019)

Log Message

[macOS] Block coreservicesd in sandbox.
https://bugs.webkit.org/show_bug.cgi?id=192670

Reviewed by Alexey Proskuryakov.

Source/WebKit:

We should block CoreServices in newer versions of macOS. In order to achieve this we need to avoid calling
_RegisterApplication before entering the sandbox, since this call will open up a connection to CoreServices.
The call to _RegisterApplication is moved to ChildProcess::updateProcessName, since it is needed to
successfully update the process name. The call to ChildProcess::updateProcessName is made after entering
the sandbox.

* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::initializeProcessName):
(WebKit::WebProcess::platformInitializeProcess):
* WebProcess/com.apple.WebProcess.sb.in:

Source/WTF:

Add HAVE_CSCHECKFIXDISABLE define.

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (241168 => 241169)


--- trunk/Source/WTF/ChangeLog	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WTF/ChangeLog	2019-02-08 00:02:49 UTC (rev 241169)
@@ -1,3 +1,14 @@
+2019-02-07  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Block coreservicesd in sandbox.
+        https://bugs.webkit.org/show_bug.cgi?id=192670
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add HAVE_CSCHECKFIXDISABLE define.
+
+        * wtf/Platform.h:
+
 2019-02-07  Eric Carlson  <eric.carl...@apple.com>
 
         [MSE] Convert debug-only logging to runtime logging

Modified: trunk/Source/WTF/wtf/Platform.h (241168 => 241169)


--- trunk/Source/WTF/wtf/Platform.h	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WTF/wtf/Platform.h	2019-02-08 00:02:49 UTC (rev 241169)
@@ -1494,3 +1494,7 @@
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
 #define HAVE_CFNETWORK_NEGOTIATED_SSL_PROTOCOL_CIPHER 1
 #endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+#define HAVE_CSCHECKFIXDISABLE 1
+#endif

Modified: trunk/Source/WebKit/ChangeLog (241168 => 241169)


--- trunk/Source/WebKit/ChangeLog	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WebKit/ChangeLog	2019-02-08 00:02:49 UTC (rev 241169)
@@ -1,3 +1,23 @@
+2019-02-07  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Block coreservicesd in sandbox.
+        https://bugs.webkit.org/show_bug.cgi?id=192670
+
+        Reviewed by Alexey Proskuryakov.
+
+        We should block CoreServices in newer versions of macOS. In order to achieve this we need to avoid calling
+        _RegisterApplication before entering the sandbox, since this call will open up a connection to CoreServices.
+        The call to _RegisterApplication is moved to ChildProcess::updateProcessName, since it is needed to
+        successfully update the process name. The call to ChildProcess::updateProcessName is made after entering
+        the sandbox.
+
+        * Shared/AuxiliaryProcess.cpp:
+        (WebKit::AuxiliaryProcess::initialize):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::initializeProcessName):
+        (WebKit::WebProcess::platformInitializeProcess):
+        * WebProcess/com.apple.WebProcess.sb.in:
+
 2019-02-07  Youenn Fablet  <you...@apple.com>
 
         Filter out Overconstrainederror.constraint when getUserMedia is not granted

Modified: trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp (241168 => 241169)


--- trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp	2019-02-08 00:02:49 UTC (rev 241169)
@@ -70,11 +70,12 @@
 #endif
 
     initializeProcess(parameters);
-    initializeProcessName(parameters);
 
     SandboxInitializationParameters sandboxParameters;
     initializeSandbox(parameters, sandboxParameters);
 
+    initializeProcessName(parameters);
+
     // In WebKit2, only the UI process should ever be generating non-default PAL::SessionIDs.
     PAL::SessionID::enableGenerationProtection();
 

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (241168 => 241169)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-02-08 00:02:49 UTC (rev 241169)
@@ -101,6 +101,10 @@
 #import <os/state_private.h>
 #endif
 
+#if HAVE(CSCHECKFIXDISABLE)
+extern "C" void _CSCheckFixDisable();
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -211,6 +215,13 @@
 void WebProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters&)
 {
 #if PLATFORM(MAC)
+#if HAVE(CSCHECKFIXDISABLE)
+    // _CSCheckFixDisable() needs to be called before checking in with Launch Services.
+    _CSCheckFixDisable();
+#endif
+    // This is necessary so that we are able to set the process' display name.
+    _RegisterApplication(nullptr, nullptr);
+
     updateProcessName();
 #endif
 }
@@ -360,10 +371,6 @@
     CGSShutdownServerConnections();
 
     SwitchingGPUClient::setSingleton(WebSwitchingGPUClient::singleton());
-
-    // This is necessary so that we are able to set the process' display name.
-    _RegisterApplication(nullptr, nullptr);
-
 #else
 
     if (![NSApp isRunning]) {

Modified: trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in (241168 => 241169)


--- trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2019-02-07 23:52:52 UTC (rev 241168)
+++ trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2019-02-08 00:02:49 UTC (rev 241169)
@@ -643,8 +643,12 @@
 
 ;; CoreFoundation. We don't import com.apple.corefoundation.sb, because it allows unnecessary access to pasteboard.
 (allow mach-lookup
-    (global-name-regex #"^com.apple.distributed_notifications")                                                       
-    (global-name "com.apple.CoreServices.coreservicesd"))
+    (global-name-regex #"^com.apple.distributed_notifications")
+#if !HAVE(CSCHECKFIXDISABLE)
+    (global-name "com.apple.CoreServices.coreservicesd")
+#endif
+)
+
 (allow file-read-data
     (literal "/dev/autofs_nowait")) ; Used by CF to circumvent automount triggers
 (allow ipc-posix-shm
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to