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

Unified Diff: util/test/mac/mach_multiprocess.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 | « util/mach/notify_server_test.cc ('k') | util/util.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/test/mac/mach_multiprocess.cc
diff --git a/util/test/mac/mach_multiprocess.cc b/util/test/mac/mach_multiprocess.cc
index 9660ee0e4aa4d45aaa4bb389d160719a6216a69b..c558eb0565405d344c27c9a5211f2fca16b5d4dd 100644
--- a/util/test/mac/mach_multiprocess.cc
+++ b/util/test/mac/mach_multiprocess.cc
@@ -28,6 +28,7 @@
#include "gtest/gtest.h"
#include "util/file/file_io.h"
#include "util/mach/mach_extensions.h"
+#include "util/mach/mach_message.h"
#include "util/misc/scoped_forbid_return.h"
#include "util/test/errors.h"
#include "util/test/mac/mach_errors.h"
@@ -40,7 +41,10 @@ struct SendHelloMessage : public mach_msg_base_t {
};
struct ReceiveHelloMessage : public SendHelloMessage {
- mach_msg_audit_trailer_t audit_trailer;
+ union {
+ mach_msg_trailer_t trailer;
+ mach_msg_audit_trailer_t audit_trailer;
+ };
};
} // namespace
@@ -120,15 +124,13 @@ task_t MachMultiprocess::ChildTask() const {
void MachMultiprocess::MultiprocessParent() {
ReceiveHelloMessage message = {};
- kern_return_t kr =
- mach_msg(&message.header,
- MACH_RCV_MSG | MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) |
- MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT),
- 0,
- sizeof(message),
- info_->local_port,
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
+ kern_return_t kr = mach_msg(&message.header,
+ MACH_RCV_MSG | kMachMessageReceiveAuditTrailer,
+ 0,
+ sizeof(message),
+ info_->local_port,
+ MACH_MSG_TIMEOUT_NONE,
+ MACH_PORT_NULL);
ASSERT_EQ(MACH_MSG_SUCCESS, kr) << MachErrorMessage(kr, "mach_msg");
// Comb through the entire message, checking every field against its expected
@@ -186,6 +188,8 @@ void MachMultiprocess::MultiprocessParent() {
EXPECT_EQ(getgid(), audit_rgid);
ASSERT_EQ(ChildPID(), audit_pid);
+ ASSERT_EQ(ChildPID(), AuditPIDFromMachMessageTrailer(&message.trailer));
+
auditinfo_addr_t audit_info;
int rv = getaudit_addr(&audit_info, sizeof(audit_info));
ASSERT_EQ(0, rv) << ErrnoMessage("getaudit_addr");
« no previous file with comments | « util/mach/notify_server_test.cc ('k') | util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698