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

Unified Diff: handler/mac/crash_report_exception_handler.cc

Issue 1001943002: handler/mac: Log a warning when an exception message has a suspicious (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: MACH_MSG_TYPE_MAKE_SEND_ONCE 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
« no previous file with comments | « no previous file | handler/mac/exception_handler_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/mac/crash_report_exception_handler.cc
diff --git a/handler/mac/crash_report_exception_handler.cc b/handler/mac/crash_report_exception_handler.cc
index b3b9605f8e7560b1dd7751404658570a996eed97..313d4e3b4a22f60102bd7808a15da831e86dd052 100644
--- a/handler/mac/crash_report_exception_handler.cc
+++ b/handler/mac/crash_report_exception_handler.cc
@@ -29,6 +29,7 @@
#include "util/mach/exc_client_variants.h"
#include "util/mach/exception_behaviors.h"
#include "util/mach/mach_extensions.h"
+#include "util/mach/mach_message.h"
#include "util/mach/scoped_task_suspend.h"
#include "util/misc/tri_state.h"
#include "util/misc/uuid.h"
@@ -119,6 +120,22 @@ kern_return_t CrashReportExceptionHandler::CatchMachException(
return KERN_FAILURE;
}
+ // Check for suspicious message sources. A suspicious exception message comes
+ // from a source other than the kernel or the process that the exception
+ // purportedly occurred in.
+ //
+ // TODO(mark): Consider exceptions outside of the range (0, 32) from the
+ // kernel to be suspicious, and exceptions other than kMachExceptionSimulated
+ // from the process itself to be suspicious.
+ pid_t audit_pid = AuditPIDFromMachMessageTrailer(trailer);
+ if (audit_pid != -1 && audit_pid != 0) {
+ pid_t exception_pid = process_snapshot.ProcessID();
+ if (exception_pid != audit_pid) {
+ LOG(WARNING) << "exception for pid " << exception_pid << " sent by pid "
+ << audit_pid;
+ }
+ }
+
CrashpadInfoClientOptions client_options;
process_snapshot.GetCrashpadOptions(&client_options);
« no previous file with comments | « no previous file | handler/mac/exception_handler_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698