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

Unified Diff: util/mach/mach_message.h

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: 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: util/mach/mach_message.h
diff --git a/util/mach/mach_message.h b/util/mach/mach_message.h
index 05695404f3c6313dfa9a8272671ff85b4c205a06..5de081852e3a0f3b935a0b07fc4d87f1b8885238 100644
--- a/util/mach/mach_message.h
+++ b/util/mach/mach_message.h
@@ -17,6 +17,7 @@
#include <mach/mach.h>
#include <stdint.h>
+#include <sys/types.h>
namespace crashpad {
@@ -148,6 +149,22 @@ void SetMIGReplyError(mach_msg_header_t* out_header, kern_return_t error);
const mach_msg_trailer_t* MachMessageTrailerFromHeader(
const mach_msg_header_t* header);
+//! \brief Returns the process ID of a Mach message’s sender from its audit
+//! trailer.
+//!
+//! For the audit trailer to be present, the message must have been received
+//! with `MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) |
+//! MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT)` specified as options.
+//!
+//! If the kernel is the message’s sender, a process ID of `0` will be returned.
+//!
+//! \param[in] trailer The trailer received with a Mach message.
+//!
+//! \return The process ID of the message’s sender, or `-1` on failure with a
+//! message logged. It is considered a failure for \a trailer to not contain
+//! audit information.
+pid_t AuditPIDFromMachMessageTrailer(const mach_msg_trailer_t* trailer);
+
} // namespace crashpad
#endif // CRASHPAD_UTIL_MACH_MACH_MESSAGE_H_

Powered by Google App Engine
This is Rietveld 408576698