[Cocoa] Create a simulated crash log when the UI Process receives an invalid CoreIPC...
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jan 2020 16:18:17 +0000 (16:18 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jan 2020 16:18:17 +0000 (16:18 +0000)
<https://webkit.org/b/205368>
<rdar://problem/58024593>

Reviewed by Chris Dumez.

* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::logInvalidMessage):
- Extract common logging code to new method that calls
  RELEASE_LOG_FAULT().
* UIProcess/AuxiliaryProcessProxy.h:
(WebKit::AuxiliaryProcessProxy::logInvalidMessage):
(WebKit::AuxiliaryProcessProxy::processName):
- Add method declarations.

* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::didReceiveInvalidMessage):
- Use new AuxiliaryProcessProxy::logInvalidMessage().
* UIProcess/GPU/GPUProcessProxy.h:
(WebKit::GPUProcessProxy::processName const):
- Add implementation.

* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveInvalidMessage):
- Use new AuxiliaryProcessProxy::logInvalidMessage().
* UIProcess/Network/NetworkProcessProxy.h:
(WebKit::NetworkProcessProxy::processName const):
- Add implementation.

* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didReceiveInvalidMessage):
- Use new AuxiliaryProcessProxy::logInvalidMessage().
* UIProcess/Plugins/PluginProcessProxy.h:
(WebKit::PluginProcessProxy::processName const):
- Add implementation.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveInvalidMessage):
- Use new AuxiliaryProcessProxy::logInvalidMessage().
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::processName const):
- Add implementation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254569 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp
Source/WebKit/UIProcess/GPU/GPUProcessProxy.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h

index 419a1d8..a587b57 100644 (file)
@@ -1,3 +1,48 @@
+2020-01-15  David Kilzer  <ddkilzer@apple.com>
+
+        [Cocoa] Create a simulated crash log when the UI Process receives an invalid CoreIPC message
+        <https://webkit.org/b/205368>
+        <rdar://problem/58024593>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/AuxiliaryProcessProxy.cpp:
+        (WebKit::AuxiliaryProcessProxy::logInvalidMessage):
+        - Extract common logging code to new method that calls
+          RELEASE_LOG_FAULT().
+        * UIProcess/AuxiliaryProcessProxy.h:
+        (WebKit::AuxiliaryProcessProxy::logInvalidMessage):
+        (WebKit::AuxiliaryProcessProxy::processName):
+        - Add method declarations.
+
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::didReceiveInvalidMessage):
+        - Use new AuxiliaryProcessProxy::logInvalidMessage().
+        * UIProcess/GPU/GPUProcessProxy.h:
+        (WebKit::GPUProcessProxy::processName const):
+        - Add implementation.
+
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didReceiveInvalidMessage):
+        - Use new AuxiliaryProcessProxy::logInvalidMessage().
+        * UIProcess/Network/NetworkProcessProxy.h:
+        (WebKit::NetworkProcessProxy::processName const):
+        - Add implementation.
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::didReceiveInvalidMessage):
+        - Use new AuxiliaryProcessProxy::logInvalidMessage().
+        * UIProcess/Plugins/PluginProcessProxy.h:
+        (WebKit::PluginProcessProxy::processName const):
+        - Add implementation.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveInvalidMessage):
+        - Use new AuxiliaryProcessProxy::logInvalidMessage().
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::processName const):
+        - Add implementation.
+
 2020-01-15  youenn fablet  <youenn@apple.com>
 
         Add support for MediaStream audio track rendering in GPUProcess
index 9794974..cca7c0a 100644 (file)
@@ -271,4 +271,9 @@ void AuxiliaryProcessProxy::connectionWillOpen(IPC::Connection&)
 {
 }
 
+void AuxiliaryProcessProxy::logInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
+{
+    RELEASE_LOG_FAULT(IPC, "Received an invalid message '%{public}s::%{public}s' from the %{public}s process.", messageReceiverName.toString().data(), messageName.toString().data(), processName().characters());
+}
+
 } // namespace WebKit
index 37fda5a..12a9c48 100644 (file)
@@ -118,7 +118,10 @@ protected:
 
     bool dispatchMessage(IPC::Connection&, IPC::Decoder&);
     bool dispatchSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
-    
+
+    void logInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName);
+    virtual ASCIILiteral processName() const = 0;
+
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&);
     virtual void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&) { };
 
index d8086df..b1459c9 100644 (file)
@@ -165,7 +165,7 @@ void GPUProcessProxy::didClose(IPC::Connection&)
 
 void GPUProcessProxy::didReceiveInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
 {
-    WTFLogAlways("Received an invalid message \"%s.%s\" from the GPU process.\n", messageReceiverName.toString().data(), messageName.toString().data());
+    logInvalidMessage(connection, messageReceiverName, messageName);
 
     WebProcessPool::didReceiveInvalidMessage(messageReceiverName, messageName);
 
index 9bd8499..0c2419d 100644 (file)
@@ -65,6 +65,8 @@ private:
     ~GPUProcessProxy();
 
     // AuxiliaryProcessProxy
+    ASCIILiteral processName() const final { return "GPU"_s; }
+
     void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void connectionWillOpen(IPC::Connection&) override;
     void processWillShutDown(IPC::Connection&) override;
index 6b0a60e..e40e544 100644 (file)
@@ -311,8 +311,9 @@ void NetworkProcessProxy::didClose(IPC::Connection&)
     networkProcessCrashed();
 }
 
-void NetworkProcessProxy::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
+void NetworkProcessProxy::didReceiveInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
 {
+    logInvalidMessage(connection, messageReceiverName, messageName);
 }
 
 void NetworkProcessProxy::processAuthenticationChallenge(PAL::SessionID sessionID, Ref<AuthenticationChallengeProxy>&& authenticationChallenge)
index 74c762a..619676d 100644 (file)
@@ -212,6 +212,8 @@ public:
 
 private:
     // AuxiliaryProcessProxy
+    ASCIILiteral processName() const final { return "Networking"_s; }
+
     void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void connectionWillOpen(IPC::Connection&) override;
     void processWillShutDown(IPC::Connection&) override;
index d8acae8..f430004 100644 (file)
@@ -214,8 +214,9 @@ void PluginProcessProxy::didClose(IPC::Connection&)
     pluginProcessCrashedOrFailedToLaunch();
 }
 
-void PluginProcessProxy::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
+void PluginProcessProxy::didReceiveInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
 {
+    logInvalidMessage(connection, messageReceiverName, messageName);
 }
 
 void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier connectionIdentifier)
index 7219921..af223db 100644 (file)
@@ -90,6 +90,9 @@ public:
 private:
     PluginProcessProxy(PluginProcessManager*, const PluginProcessAttributes&, uint64_t pluginProcessToken);
 
+    // AuxiliaryProcessProxy
+    ASCIILiteral processName() const final { return "Plugin"_s; }
+
     void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void platformGetLaunchOptionsWithAttributes(ProcessLauncher::LaunchOptions&, const PluginProcessAttributes&);
     void processWillShutDown(IPC::Connection&) override;
index 888ed49..98c55d6 100644 (file)
@@ -806,11 +806,11 @@ void WebProcessProxy::processDidTerminateOrFailedToLaunch()
 
 void WebProcessProxy::didReceiveInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
 {
-    WTFLogAlways("Received an invalid message \"%s.%s\" from the web process.\n", messageReceiverName.toString().data(), messageName.toString().data());
+    logInvalidMessage(connection, messageReceiverName, messageName);
 
     WebProcessPool::didReceiveInvalidMessage(messageReceiverName, messageName);
 
-    // Terminate the WebProcess.
+    // Terminate the WebContent process.
     terminate();
 
     // Since we've invalidated the connection we'll never get a IPC::Connection::Client::didClose
index add3de6..629f480 100644 (file)
@@ -354,6 +354,8 @@ protected:
     WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
 
     // AuxiliaryProcessProxy
+    ASCIILiteral processName() const final { return "WebContent"_s; }
+
     void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void connectionWillOpen(IPC::Connection&) override;