Changeset 263295 in webkit
- Timestamp:
- Jun 19, 2020, 4:37:55 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/cf/CFUtilitiesSPI.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/mac/NetworkProcessMac.mm (modified) (1 diff)
-
WebKit/Shared/AuxiliaryProcess.cpp (modified) (2 diffs)
-
WebKit/Shared/Cocoa/WebKit2InitializeCocoa.mm (modified) (2 diffs)
-
WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (modified) (2 diffs)
-
WebKit/Shared/mac/AuxiliaryProcessMac.mm (modified) (1 diff)
-
WebKit/WebProcess/cocoa/WebProcessCocoa.mm (modified) (4 diffs)
-
WebKit/WebProcess/com.apple.WebProcess.sb.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/PAL/ChangeLog
r263255 r263295 1 2020-06-19 Per Arne Vollan <pvollan@apple.com> 2 3 [macOS] Connections to the preference daemon are established before entering the sandbox 4 https://bugs.webkit.org/show_bug.cgi?id=213379 5 6 Reviewed by Darin Adler. 7 8 Use correct parameter types in _CFPrefsSetDirectModeEnabled and _CFPrefsSetReadOnly, and move 9 _CFPrefsSetDirectModeEnabled inside an Objective-C guard, since BOOL only seems to be a builtin 10 type in Objective-C. 11 12 * pal/spi/cf/CFUtilitiesSPI.h: 13 1 14 2020-06-19 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/Source/WebCore/PAL/pal/spi/cf/CFUtilitiesSPI.h
r262639 r263295 59 59 void __CFRunLoopSetOptionsReason(__CFRunLoopOptions opts, CFStringRef reason); 60 60 61 void _CFPrefsSetDirectModeEnabled(bool enabled); 62 void _CFPrefsSetReadOnly(bool flag); 61 #ifdef __OBJC__ 62 void _CFPrefsSetDirectModeEnabled(BOOL enabled); 63 #endif 64 void _CFPrefsSetReadOnly(Boolean flag); 63 65 64 66 WTF_EXTERN_C_END -
trunk/Source/WebKit/ChangeLog
r263293 r263295 1 2020-06-19 Per Arne Vollan <pvollan@apple.com> 2 3 [macOS] Connections to the preference daemon are established before entering the sandbox 4 https://bugs.webkit.org/show_bug.cgi?id=213379 5 6 Reviewed by Darin Adler. 7 8 On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist 9 after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the 10 preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves 11 code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to 12 prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:], 13 call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon. 14 Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the 15 preference daemon. 16 17 No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no 18 connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this. 19 20 * NetworkProcess/mac/NetworkProcessMac.mm: 21 (WebKit::NetworkProcess::initializeSandbox): 22 * Shared/AuxiliaryProcess.cpp: 23 (WebKit::AuxiliaryProcess::initialize): 24 * Shared/Cocoa/WebKit2InitializeCocoa.mm: 25 (WebKit::runInitializationCode): 26 * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: 27 (WebKit::XPCServiceMain): 28 * Shared/mac/AuxiliaryProcessMac.mm: 29 (WebKit::webKit2Bundle): 30 * WebProcess/cocoa/WebProcessCocoa.mm: 31 (WebKit::WebProcess::platformInitializeWebProcess): 32 (WebKit::WebProcess::initializeSandbox): 33 * WebProcess/com.apple.WebProcess.sb.in: 34 1 35 2020-06-19 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm
r258665 r263295 88 88 { 89 89 // Need to overide the default, because service has a different bundle ID. 90 NSBundle *webKit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];90 auto webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"]; 91 91 92 sandboxParameters.setOverrideSandboxProfilePath( [webKit2Bundle pathForResource:@"com.apple.WebKit.NetworkProcess" ofType:@"sb"]);92 sandboxParameters.setOverrideSandboxProfilePath(makeString(String([webKitBundle resourcePath]), "/com.apple.WebKit.NetworkProcess.sb")); 93 93 94 94 AuxiliaryProcess::initializeSandbox(parameters, sandboxParameters); -
trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp
r261254 r263295 28 28 29 29 #include "ContentWorldShared.h" 30 #include "LogInitialization.h" 30 31 #include "Logging.h" 31 32 #include "SandboxInitializationParameters.h" 33 #include <WebCore/LogInitialization.h> 32 34 #include <pal/SessionID.h> 33 35 … … 76 78 SandboxInitializationParameters sandboxParameters; 77 79 initializeSandbox(parameters, sandboxParameters); 80 81 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED 82 WebCore::initializeLogChannelsIfNecessary(); 83 WebKit::initializeLogChannelsIfNecessary(); 84 #endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED 78 85 79 86 initializeProcessName(parameters); -
trunk/Source/WebKit/Shared/Cocoa/WebKit2InitializeCocoa.mm
r262878 r263295 27 27 #import "WebKit2Initialize.h" 28 28 29 #import "LogInitialization.h"30 29 #import "VersionChecks.h" 31 30 #import <JavaScriptCore/InitializeThreading.h> 32 #import <WebCore/LogInitialization.h>33 31 #import <mutex> 34 32 #import <wtf/MainThread.h> … … 57 55 58 56 WTF::RefCountedBase::enableThreadingChecksGlobally(); 59 60 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED61 WebCore::initializeLogChannelsIfNecessary();62 WebKit::initializeLogChannelsIfNecessary();63 #endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED64 57 } 65 58 -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
r262730 r263295 33 33 #import <wtf/RetainPtr.h> 34 34 #import <wtf/spi/darwin/XPCSPI.h> 35 36 #if PLATFORM(MAC)37 #import <pal/spi/mac/NSApplicationSPI.h>38 #endif39 35 40 36 namespace WebKit { … … 170 166 // Don't allow Apple Events in WebKit processes. This can be removed when <rdar://problem/14012823> is fixed. 171 167 setenv("__APPLEEVENTSSERVICENAME", "", 1); 172 173 // We don't need to talk to the dock.174 if (Class nsApplicationClass = NSClassFromString(@"NSApplication")) {175 if ([nsApplicationClass respondsToSelector:@selector(_preventDockConnections)])176 [nsApplicationClass _preventDockConnections];177 }178 168 #endif 179 169 -
trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
r262005 r263295 521 521 static inline const NSBundle *webKit2Bundle() 522 522 { 523 const static NSBundle *bundle = [NSBundle bundle ForClass:NSClassFromString(@"WKWebView")];523 const static NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"]; 524 524 return bundle; 525 525 } -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r263287 r263295 186 186 } 187 187 188 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED189 WebCore::initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);190 WebKit::initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);191 #endif192 193 188 WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier); 194 189 setApplicationSDKVersion(parameters.uiProcessSDKVersion); … … 232 227 233 228 #if USE(APPKIT) 229 // We don't need to talk to the Dock. 230 [NSApplication _preventDockConnections]; 231 234 232 [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions" : @YES }]; 235 233 … … 239 237 method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement); 240 238 #endif 241 239 242 240 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_NSRUNLOOP) 243 241 // Need to initialize accessibility for VoiceOver to work when the WebContent process is using NSRunLoop. … … 583 581 #if PLATFORM(MAC) || PLATFORM(MACCATALYST) 584 582 // Need to override the default, because service has a different bundle ID. 585 NSBundle *webKit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];586 587 sandboxParameters.setOverrideSandboxProfilePath( [webKit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"]);583 auto webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"]; 584 585 sandboxParameters.setOverrideSandboxProfilePath(makeString(String([webKitBundle resourcePath]), "/com.apple.WebProcess.sb")); 588 586 589 587 AuxiliaryProcess::initializeSandbox(parameters, sandboxParameters); -
trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in
r263287 r263295 1101 1101 #endif 1102 1102 (syscall-number SYS_fstat64_extended) ;; <rdar://problem/61310019> 1103 (syscall-number SYS_gethostuuid) 1103 1104 ) 1104 1105
Note:
See TracChangeset
for help on using the changeset viewer.