Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1753)

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1009583004: Add UMA histograms and logging for bad IPC message handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 9dbebd3d0b0d69f71495d06297114a6bd54808c4..58db2fd6d1ce7f0867a1d3ee17a6cdbceee4df05 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -114,6 +114,7 @@
#include "content/common/mojo/mojo_messages.h"
#include "content/common/resource_messages.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/bad_message.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/navigator_connect_context.h"
@@ -1043,7 +1044,7 @@ void RenderProcessHostImpl::RemoveObserver(
observers_.RemoveObserver(observer);
}
-void RenderProcessHostImpl::ReceivedBadMessage() {
+void RenderProcessHostImpl::ReceivedBadMessage(BadMessage reason) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableKillAfterBadIPC))
return;
@@ -1053,6 +1054,13 @@ void RenderProcessHostImpl::ReceivedBadMessage() {
// crash.
CHECK(false);
}
+
+ LOG(ERROR) << "Terminating renderer for bad IPC message, reason "
+ << static_cast<int>(reason);
+ UMA_HISTOGRAM_ENUMERATION("Stability.BadMessageTerminated",
+ static_cast<int>(reason),
+ static_cast<int>(BadMessage::BAD_MESSAGE_MAX));
+
// We kill the renderer but don't include a NOTREACHED, because we want the
// browser to try to survive when it gets illegal messages from the renderer.
Shutdown(RESULT_CODE_KILLED_BAD_MESSAGE, false);
@@ -1561,7 +1569,7 @@ void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
LOG(ERROR) << "bad message " << message.type() << " terminating renderer.";
BrowserChildProcessHostImpl::HistogramBadMessageTerminated(
Charlie Reis 2015/03/13 23:41:49 Huh, I wonder if we need this anymore. I guess it
PROCESS_TYPE_RENDERER);
- ReceivedBadMessage();
+ ReceivedBadMessage(BadMessage::RPH_DESERIALIZATION_FAILED);
}
BrowserContext* RenderProcessHostImpl::GetBrowserContext() const {
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698