Title: [293890] trunk/Source/WebKit
Revision
293890
Author
[email protected]
Date
2022-05-06 08:13:36 -0700 (Fri, 06 May 2022)

Log Message

GPU Process crash under IPC::Connection::open() ASSERTION FAILED: m_sendPort
https://bugs.webkit.org/show_bug.cgi?id=240146

Patch by Kimmo Kinnunen <[email protected]> on 2022-05-06
Reviewed by Chris Dumez.

If WP creates connection to GPUP but then exits, the
sent mach send right for communication comes out as MACH_PORT_DEAD_NAME in GPUP.
This will prevent proper initialization of IPC::Connection. This will
later assert in IPC::Connection::open().

Fix by checking identifierIsValid(). This will succeed only if the
listening port was alive at the time the send port was received.

Speculative fix.
Regression from r293829.

* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::createGPUConnectionToWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (293889 => 293890)


--- trunk/Source/WebKit/ChangeLog	2022-05-06 15:02:38 UTC (rev 293889)
+++ trunk/Source/WebKit/ChangeLog	2022-05-06 15:13:36 UTC (rev 293890)
@@ -1,3 +1,24 @@
+2022-05-06  Kimmo Kinnunen  <[email protected]>
+
+        GPU Process crash under IPC::Connection::open() ASSERTION FAILED: m_sendPort
+        https://bugs.webkit.org/show_bug.cgi?id=240146
+
+        Reviewed by Chris Dumez.
+
+        If WP creates connection to GPUP but then exits, the
+        sent mach send right for communication comes out as MACH_PORT_DEAD_NAME in GPUP.
+        This will prevent proper initialization of IPC::Connection. This will
+        later assert in IPC::Connection::open().
+
+        Fix by checking identifierIsValid(). This will succeed only if the
+        listening port was alive at the time the send port was received.
+
+        Speculative fix.
+        Regression from r293829.
+
+        * GPUProcess/GPUProcess.cpp:
+        (WebKit::GPUProcess::createGPUConnectionToWebProcess):
+
 2022-05-06  Youenn Fablet  <[email protected]>
 
         Allow MediaPlayerPrivateMediaStreamAVFObjC to avoid pixel conformers if IOSurfaces are not allowed

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (293889 => 293890)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-05-06 15:02:38 UTC (rev 293889)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-05-06 15:13:36 UTC (rev 293890)
@@ -56,6 +56,7 @@
 #include <wtf/OptionSet.h>
 #include <wtf/ProcessPrivilege.h>
 #include <wtf/RunLoop.h>
+#include <wtf/Scope.h>
 #include <wtf/UniqueRef.h>
 #include <wtf/text/AtomString.h>
 
@@ -129,12 +130,19 @@
 #endif
 }
 
-void GPUProcess::createGPUConnectionToWebProcess(WebCore::ProcessIdentifier identifier, PAL::SessionID sessionID, IPC::Attachment&& connectionIdentifier, GPUProcessConnectionParameters&& parameters, CompletionHandler<void()>&& completionHandler)
+void GPUProcess::createGPUConnectionToWebProcess(WebCore::ProcessIdentifier identifier, PAL::SessionID sessionID, IPC::Attachment&& connectionHandle, GPUProcessConnectionParameters&& parameters, CompletionHandler<void()>&& completionHandler)
 {
     RELEASE_LOG(Process, "%p - GPUProcess::createGPUConnectionToWebProcess: processIdentifier=%" PRIu64, this, identifier.toUInt64());
 
-    auto newConnection = GPUConnectionToWebProcess::create(*this, identifier, sessionID, asConnectionIdentifier(WTFMove(connectionIdentifier)), WTFMove(parameters));
+    auto reply = makeScopeExit(WTFMove(completionHandler));
+    auto connectionIdentifier = asConnectionIdentifier(WTFMove(connectionHandle));
+    // If sender exited before we received the identifier, the identifier
+    // may not be valid.
+    if (!IPC::Connection::identifierIsValid(connectionIdentifier))
+        return;
 
+    auto newConnection = GPUConnectionToWebProcess::create(*this, identifier, sessionID, WTFMove(connectionIdentifier), WTFMove(parameters));
+
 #if ENABLE(MEDIA_STREAM)
     // FIXME: We should refactor code to go from WebProcess -> GPUProcess -> UIProcess when getUserMedia is called instead of going from WebProcess -> UIProcess directly.
     auto access = m_mediaCaptureAccessMap.take(identifier);
@@ -149,9 +157,6 @@
 
     ASSERT(!m_webProcessConnections.contains(identifier));
     m_webProcessConnections.add(identifier, WTFMove(newConnection));
-
-
-    completionHandler();
 }
 
 void GPUProcess::removeGPUConnectionToWebProcess(GPUConnectionToWebProcess& connection)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to