Title: [275899] trunk/Source
Revision
275899
Author
[email protected]
Date
2021-04-13 12:46:47 -0700 (Tue, 13 Apr 2021)

Log Message

Revert r275172
https://bugs.webkit.org/show_bug.cgi?id=224499
<rdar://76396241>

Patch by Alex Christensen <[email protected]> on 2021-04-13
Reviewed by Tim Horton.

Source/WebKit:

It turns out that terminate_with_reason uses a different syscall than xpc_connection_kill in its implementation,
and the former is not allowed by Messages's sandbox yet.  Revert for Messages until they add it.

* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
(IPC::Connection::kill):
* Platform/spi/Cocoa/ReasonSPI.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::platformInvalidate):
(WebKit::terminateWithReason):

Source/WTF:

* wtf/spi/darwin/XPCSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (275898 => 275899)


--- trunk/Source/WTF/ChangeLog	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WTF/ChangeLog	2021-04-13 19:46:47 UTC (rev 275899)
@@ -1,3 +1,13 @@
+2021-04-13  Alex Christensen  <[email protected]>
+
+        Revert r275172
+        https://bugs.webkit.org/show_bug.cgi?id=224499
+        <rdar://76396241>
+
+        Reviewed by Tim Horton.
+
+        * wtf/spi/darwin/XPCSPI.h:
+
 2021-04-12  Basuke Suzuki  <[email protected]>
 
         [PlayStation] Enable WTFCrashWithInfo implementation

Modified: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h (275898 => 275899)


--- trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-04-13 19:46:47 UTC (rev 275899)
@@ -162,6 +162,7 @@
 
 xpc_object_t xpc_connection_copy_entitlement_value(xpc_connection_t, const char* entitlement);
 void xpc_connection_get_audit_token(xpc_connection_t, audit_token_t*);
+void xpc_connection_kill(xpc_connection_t, int);
 void xpc_connection_set_instance(xpc_connection_t, uuid_t);
 mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
 void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t);

Modified: trunk/Source/WebKit/ChangeLog (275898 => 275899)


--- trunk/Source/WebKit/ChangeLog	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WebKit/ChangeLog	2021-04-13 19:46:47 UTC (rev 275899)
@@ -1,3 +1,22 @@
+2021-04-13  Alex Christensen  <[email protected]>
+
+        Revert r275172
+        https://bugs.webkit.org/show_bug.cgi?id=224499
+        <rdar://76396241>
+
+        Reviewed by Tim Horton.
+
+        It turns out that terminate_with_reason uses a different syscall than xpc_connection_kill in its implementation,
+        and the former is not allowed by Messages's sandbox yet.  Revert for Messages until they add it.
+
+        * Platform/IPC/cocoa/ConnectionCocoa.mm:
+        (IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
+        (IPC::Connection::kill):
+        * Platform/spi/Cocoa/ReasonSPI.h:
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::ProcessLauncher::platformInvalidate):
+        (WebKit::terminateWithReason):
+
 2021-04-13  Jer Noble  <[email protected]>
 
         [Cocoa] remove link-time dependency on WebKitSwift

Modified: trunk/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm (275898 => 275899)


--- trunk/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm	2021-04-13 19:46:47 UTC (rev 275899)
@@ -97,7 +97,7 @@
     
     void watchdogTimerFired()
     {
-        terminate_with_reason(xpc_connection_get_pid(m_xpcConnection.get()), OS_REASON_WEBKIT, static_cast<uint64_t>(WebKit::ReasonCode::WatchdogTimerFired), "ConnectionTerminationWatchdog::watchdogTimerFired", OS_REASON_FLAG_NO_CRASH_REPORT);
+        terminateWithReason(m_xpcConnection.get(), WebKit::ReasonCode::WatchdogTimerFired, "ConnectionTerminationWatchdog::watchdogTimerFired");
         delete this;
     }
 
@@ -608,7 +608,7 @@
 bool Connection::kill()
 {
     if (m_xpcConnection) {
-        terminate_with_reason(xpc_connection_get_pid(m_xpcConnection.get()), OS_REASON_WEBKIT, static_cast<uint64_t>(WebKit::ReasonCode::ConnectionKilled), "Connection::kill", OS_REASON_FLAG_NO_CRASH_REPORT);
+        terminateWithReason(m_xpcConnection.get(), WebKit::ReasonCode::ConnectionKilled, "Connection::kill");
         m_wasKilled = true;
         return true;
     }

Modified: trunk/Source/WebKit/Platform/spi/Cocoa/ReasonSPI.h (275898 => 275899)


--- trunk/Source/WebKit/Platform/spi/Cocoa/ReasonSPI.h	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/ReasonSPI.h	2021-04-13 19:46:47 UTC (rev 275899)
@@ -60,4 +60,6 @@
     ConnectionKilled,
 };
 
+void terminateWithReason(xpc_connection_t, ReasonCode, const char* reason);
+
 }

Modified: trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (275898 => 275899)


--- trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2021-04-13 19:10:07 UTC (rev 275898)
+++ trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2021-04-13 19:46:47 UTC (rev 275899)
@@ -337,8 +337,22 @@
         return;
 
     xpc_connection_cancel(m_xpcConnection.get());
-    terminate_with_reason(xpc_connection_get_pid(m_xpcConnection.get()), OS_REASON_WEBKIT, static_cast<uint64_t>(WebKit::ReasonCode::Invalidation), "ProcessLauncher::platformInvalidate", OS_REASON_FLAG_NO_CRASH_REPORT);
+    terminateWithReason(m_xpcConnection.get(), WebKit::ReasonCode::Invalidation, "ProcessLauncher::platformInvalidate");
     m_xpcConnection = nullptr;
 }
 
+void terminateWithReason(xpc_connection_t connection, ReasonCode reasonCode, const char* reason)
+{
+#if PLATFORM(MACCATALYST)
+    // FIXME: Remove this once rdar://76601307 is fixed.
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    xpc_connection_kill(connection, SIGKILL);
+    ALLOW_DEPRECATED_DECLARATIONS_END
+    UNUSED_PARAM(reasonCode);
+    UNUSED_PARAM(reason);
+#else
+    terminate_with_reason(xpc_connection_get_pid(connection), OS_REASON_WEBKIT, static_cast<uint64_t>(reasonCode), reason, OS_REASON_FLAG_NO_CRASH_REPORT);
+#endif
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to