Changeset 250799 in webkit
- Timestamp:
- Oct 7, 2019 3:14:41 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250780 r250799 1 2019-10-07 Per Arne Vollan <pvollan@apple.com> 2 3 [macOS] Layering violation in AuxiliaryProcessProxy::didFinishLaunching 4 https://bugs.webkit.org/show_bug.cgi?id=201617 5 6 Reviewed by Brent Fulgham. 7 8 The commit <https://trac.webkit.org/changeset/249649> introduced a layering violation in AuxiliaryProcessProxy::didFinishLaunching 9 where we inspect the pending message queue looking for a local file load message which needs the PID to create a sandbox extension 10 for the WebContent process. The layering violation can be fixed by creating a virtual method in AuxiliaryProcessProxy and override 11 the method in the WebProcessProxy to do the work needed to replace the message with a load request message containing a sandbox 12 extension created using the PID of the WebContent process. No new tests have been created, since this is covered by existing tests. 13 14 * UIProcess/AuxiliaryProcessProxy.cpp: 15 (WebKit::AuxiliaryProcessProxy::didFinishLaunching): 16 * UIProcess/AuxiliaryProcessProxy.h: 17 (WebKit::AuxiliaryProcessProxy::shouldSendPendingMessage): 18 * UIProcess/WebProcessProxy.cpp: 19 (WebKit::WebProcessProxy::shouldSendPendingMessage): 20 * UIProcess/WebProcessProxy.h: 21 1 22 2019-10-07 Dean Jackson <dino@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
r250329 r250799 28 28 29 29 #include "AuxiliaryProcessMessages.h" 30 #include "LoadParameters.h"31 30 #include "Logging.h" 32 #include "WebPageMessages.h"33 31 #include "WebPageProxy.h" 34 32 #include "WebProcessProxy.h" … … 212 210 213 211 for (auto&& pendingMessage : std::exchange(m_pendingMessages, { })) { 212 if (!shouldSendPendingMessage(pendingMessage)) 213 continue; 214 214 auto encoder = WTFMove(pendingMessage.encoder); 215 215 auto sendOptions = pendingMessage.sendOptions; 216 #if HAVE(SANDBOX_ISSUE_MACH_EXTENSION_TO_PROCESS_BY_PID)217 if (encoder->messageName() == "LoadRequestWaitingForPID") {218 auto buffer = encoder->buffer();219 auto bufferSize = encoder->bufferSize();220 std::unique_ptr<IPC::Decoder> decoder = makeUnique<IPC::Decoder>(buffer, bufferSize, nullptr, Vector<IPC::Attachment> { });221 LoadParameters loadParameters;222 URL resourceDirectoryURL;223 WebPageProxyIdentifier pageID;224 if (decoder->decode(loadParameters) && decoder->decode(resourceDirectoryURL) && decoder->decode(pageID)) {225 if (auto* page = WebProcessProxy::webPage(pageID)) {226 page->maybeInitializeSandboxExtensionHandle(static_cast<WebProcessProxy&>(*this), loadParameters.request.url(), resourceDirectoryURL, loadParameters.sandboxExtensionHandle);227 send(Messages::WebPage::LoadRequest(loadParameters), decoder->destinationID());228 }229 } else230 ASSERT_NOT_REACHED();231 continue;232 }233 #endif234 216 if (pendingMessage.asyncReplyInfo) 235 217 IPC::addAsyncReplyHandler(*connection(), pendingMessage.asyncReplyInfo->second, WTFMove(pendingMessage.asyncReplyInfo->first)); -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
r250329 r250799 123 123 virtual void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&) { }; 124 124 125 private:126 virtual void connectionWillOpen(IPC::Connection&);127 virtual void processWillShutDown(IPC::Connection&) = 0;128 129 125 struct PendingMessage { 130 126 std::unique_ptr<IPC::Encoder> encoder; … … 132 128 Optional<std::pair<CompletionHandler<void(IPC::Decoder*)>, uint64_t>> asyncReplyInfo; 133 129 }; 134 130 131 virtual bool shouldSendPendingMessage(const PendingMessage&) { return true; } 132 133 private: 134 virtual void connectionWillOpen(IPC::Connection&); 135 virtual void processWillShutDown(IPC::Connection&) = 0; 136 135 137 Vector<PendingMessage> m_pendingMessages; 136 138 RefPtr<ProcessLauncher> m_processLauncher; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r250084 r250799 32 32 #include "DataReference.h" 33 33 #include "DownloadProxyMap.h" 34 #include "LoadParameters.h" 34 35 #include "Logging.h" 35 36 #include "PluginInfoStore.h" … … 44 45 #include "WebNotificationManagerProxy.h" 45 46 #include "WebPageGroup.h" 47 #include "WebPageMessages.h" 46 48 #include "WebPageProxy.h" 47 49 #include "WebPasteboardProxy.h" … … 303 305 #endif 304 306 307 bool WebProcessProxy::shouldSendPendingMessage(const PendingMessage& message) 308 { 309 #if HAVE(SANDBOX_ISSUE_MACH_EXTENSION_TO_PROCESS_BY_PID) 310 if (message.encoder->messageName() == "LoadRequestWaitingForPID") { 311 auto buffer = message.encoder->buffer(); 312 auto bufferSize = message.encoder->bufferSize(); 313 std::unique_ptr<IPC::Decoder> decoder = makeUnique<IPC::Decoder>(buffer, bufferSize, nullptr, Vector<IPC::Attachment> { }); 314 LoadParameters loadParameters; 315 URL resourceDirectoryURL; 316 WebPageProxyIdentifier pageID; 317 if (decoder->decode(loadParameters) && decoder->decode(resourceDirectoryURL) && decoder->decode(pageID)) { 318 if (auto* page = WebProcessProxy::webPage(pageID)) { 319 page->maybeInitializeSandboxExtensionHandle(static_cast<WebProcessProxy&>(*this), loadParameters.request.url(), resourceDirectoryURL, loadParameters.sandboxExtensionHandle); 320 send(Messages::WebPage::LoadRequest(loadParameters), decoder->destinationID()); 321 } 322 } else 323 ASSERT_NOT_REACHED(); 324 return false; 325 } 326 #endif 327 return true; 328 } 329 305 330 void WebProcessProxy::connectionWillOpen(IPC::Connection& connection) 306 331 { -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r250428 r250799 330 330 void connectionWillOpen(IPC::Connection&) override; 331 331 void processWillShutDown(IPC::Connection&) override; 332 332 bool shouldSendPendingMessage(const PendingMessage&) final; 333 333 334 // ProcessLauncher::Client 334 335 void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
Note: See TracChangeset
for help on using the changeset viewer.