Title: [294809] trunk/Source/WebKit
Revision
294809
Author
pvol...@apple.com
Date
2022-05-25 11:01:30 -0700 (Wed, 25 May 2022)

Log Message

Add logging related to Mach bootstrap enablement
https://bugs.webkit.org/show_bug.cgi?id=240909

Reviewed by Chris Dumez.

We are seeing telemetry that indicates that enabling Mach bootstrap is failing in some cases.
Add logging to help diagnose this.

* Source/WebKit/Platform/Logging.h:
* Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtension::createHandleForMachLookup):
* Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtension::createHandleForMachLookup):

Canonical link: https://commits.webkit.org/250963@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/Platform/Logging.h (294808 => 294809)


--- trunk/Source/WebKit/Platform/Logging.h	2022-05-25 17:57:41 UTC (rev 294808)
+++ trunk/Source/WebKit/Platform/Logging.h	2022-05-25 18:01:30 UTC (rev 294809)
@@ -93,6 +93,7 @@
     M(RemoteLayerTree) \
     M(Resize) \
     M(ResourceLoadStatistics) \
+    M(Sandbox) \
     M(ScrollAnimations) \
     M(Scrolling) \
     M(Selection) \

Modified: trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm (294808 => 294809)


--- trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm	2022-05-25 17:57:41 UTC (rev 294808)
+++ trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm	2022-05-25 18:01:30 UTC (rev 294809)
@@ -32,6 +32,7 @@
 #import "DataReference.h"
 #import "Decoder.h"
 #import "Encoder.h"
+#import "Logging.h"
 #import "WebCoreArgumentCoders.h"
 #import <string.h>
 #import <wtf/FileSystem.h>
@@ -337,8 +338,11 @@
     // This is done by unblocking launchd, since launchd access is required when creating Mach connections.
     // Unblocking launchd is done by enabling a sandbox state variable.
     // In the initial version of this change, Mach bootstrap'ing is enabled unconditionally.
-    if (auditToken)
-        sandbox_enable_state_flag(ENABLE_MACH_BOOTSTRAP, *auditToken);
+    if (auditToken) {
+        if (!sandbox_enable_state_flag(ENABLE_MACH_BOOTSTRAP, *auditToken))
+            RELEASE_LOG_FAULT(Sandbox, "Could not enable Mach bootstrap, errno = %d.", errno);
+    } else if (machBootstrapOptions == MachBootstrapOptions::EnableMachBootstrap)
+        RELEASE_LOG_FAULT(Sandbox, "Could not enable Mach bootstrap, no audit token provided.");
 #endif
 
     return WTFMove(handle);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to