Skip to content

Commit

Permalink
Unreviewed, reverting 277204@main.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274553

Introduced crash

Reverted changeset:

"Avoid IPC to OpenDirectory XPC service on main thread"
https://bugs.webkit.org/show_bug.cgi?id=272192
https://commits.webkit.org/277204@main

Canonical link: https://commits.webkit.org/279155@main
  • Loading branch information
webkit-commit-queue authored and pvollan committed May 22, 2024
1 parent 1fc4f38 commit 223c3b4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
9 changes: 3 additions & 6 deletions Source/WebKit/GPUProcess/mac/GPUProcessMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#import <pal/spi/cocoa/CoreServicesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <sysexits.h>
#import <wtf/BlockPtr.h>
#import <wtf/MemoryPressureHandler.h>
#import <wtf/ProcessPrivilege.h>
#import <wtf/text/WTFString.h>
Expand Down Expand Up @@ -112,12 +111,10 @@

void GPUProcess::openDirectoryCacheInvalidated(SandboxExtension::Handle&& handle)
{
auto cacheInvalidationHandler = [handle = WTFMove(handle)] () mutable {
AuxiliaryProcess::openDirectoryCacheInvalidated(WTFMove(handle));
};
dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), makeBlockPtr(WTFMove(cacheInvalidationHandler)).get());
AuxiliaryProcess::openDirectoryCacheInvalidated(WTFMove(handle));
}
#endif // PLATFORM(MAC)

#endif

#if HAVE(POWERLOG_TASK_MODE_QUERY)
void GPUProcess::enablePowerLogging(SandboxExtension::Handle&& handle)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/Shared/AuxiliaryProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class AuxiliaryProcess : public IPC::Connection::Client, public IPC::MessageSend
void applyProcessCreationParameters(const AuxiliaryProcessCreationParameters&);

#if PLATFORM(MAC)
static void openDirectoryCacheInvalidated(SandboxExtension::Handle&&);
void openDirectoryCacheInvalidated(SandboxExtension::Handle&&);
#endif

void populateMobileGestaltCache(std::optional<SandboxExtension::Handle>&& mobileGestaltExtensionHandle);
Expand Down
17 changes: 4 additions & 13 deletions Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,6 @@ static String getHomeDirectory()
return String::fromUTF8(pwd.pw_dir);
}

static void closeOpenDirectoryConnections()
{
if (mbr_close_connectionsPtr())
mbr_close_connectionsPtr()();
if (lookup_close_connectionsPtr())
lookup_close_connectionsPtr()();
}

static void populateSandboxInitializationParameters(SandboxInitializationParameters& sandboxParameters)
{
RELEASE_ASSERT(!sandboxParameters.userDirectorySuffix().isNull());
Expand Down Expand Up @@ -710,9 +702,10 @@ static void populateSandboxInitializationParameters(SandboxInitializationParamet
#else
#error "Unknown architecture."
#endif

closeOpenDirectoryConnections();

if (mbr_close_connectionsPtr())
mbr_close_connectionsPtr()();
if (lookup_close_connectionsPtr())
lookup_close_connectionsPtr()();
if (HIS_XPC_ResetMessageConnectionPtr())
HIS_XPC_ResetMessageConnectionPtr()();
}
Expand Down Expand Up @@ -823,8 +816,6 @@ static void populateSandboxInitializationParameters(SandboxInitializationParamet
getHomeDirectory();

sandboxExtension->revoke();

closeOpenDirectoryConnections();
}
#endif // PLATFORM(MAC)

Expand Down
21 changes: 8 additions & 13 deletions Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
#import <pal/spi/cocoa/pthreadSPI.h>
#import <pal/spi/mac/NSApplicationSPI.h>
#import <stdio.h>
#import <wtf/BlockPtr.h>
#import <wtf/FileSystem.h>
#import <wtf/Language.h>
#import <wtf/LogInitialization.h>
Expand Down Expand Up @@ -1543,19 +1542,15 @@ static float currentBacklightLevel()
#if PLATFORM(MAC)
void WebProcess::openDirectoryCacheInvalidated(SandboxExtension::Handle&& handle, SandboxExtension::Handle&& machBootstrapHandle)
{
auto cacheInvalidationHandler = [handle = WTFMove(handle), machBootstrapHandle = WTFMove(machBootstrapHandle)] () mutable {
auto bootstrapExtension = SandboxExtension::create(WTFMove(machBootstrapHandle));
auto bootstrapExtension = SandboxExtension::create(WTFMove(machBootstrapHandle));

if (bootstrapExtension)
bootstrapExtension->consume();

AuxiliaryProcess::openDirectoryCacheInvalidated(WTFMove(handle));

if (bootstrapExtension)
bootstrapExtension->revoke();
};

dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), makeBlockPtr(WTFMove(cacheInvalidationHandler)).get());
if (bootstrapExtension)
bootstrapExtension->consume();

AuxiliaryProcess::openDirectoryCacheInvalidated(WTFMove(handle));

if (bootstrapExtension)
bootstrapExtension->revoke();
}
#endif

Expand Down

0 comments on commit 223c3b4

Please sign in to comment.