Skip to content
Permalink
Browse files
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
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pvollan committed May 25, 2022
1 parent 09ce342 commit 68076602c155deeeb1af051a0f944c4c04937201
Showing 2 changed files with 7 additions and 2 deletions.
@@ -93,6 +93,7 @@ extern "C" {
M(RemoteLayerTree) \
M(Resize) \
M(ResourceLoadStatistics) \
M(Sandbox) \
M(ScrollAnimations) \
M(Scrolling) \
M(Selection) \
@@ -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 @@ String resolvePathForSandboxExtension(StringView path)
// 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);

0 comments on commit 6807660

Please sign in to comment.