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

Unified Diff: snapshot/mac/mach_o_image_annotations_reader_test.cc

Issue 1276553005: Don’t use DYLD_INSERT_LIBRARIES with a system executable (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 4 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 | snapshot/mac/mach_o_image_annotations_reader_test_no_op.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/mac/mach_o_image_annotations_reader_test.cc
diff --git a/snapshot/mac/mach_o_image_annotations_reader_test.cc b/snapshot/mac/mach_o_image_annotations_reader_test.cc
index b9a782ca8b76d170081cdf7bf809bb0f92f389a0..12dc6e510a8ecc3a88d444feccca05c2ce159ad9 100644
--- a/snapshot/mac/mach_o_image_annotations_reader_test.cc
+++ b/snapshot/mac/mach_o_image_annotations_reader_test.cc
@@ -26,6 +26,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/files/file_path.h"
#include "client/crashpad_info.h"
#include "client/simple_string_dictionary.h"
#include "gtest/gtest.h"
@@ -33,6 +34,7 @@
#include "test/errors.h"
#include "test/mac/mach_errors.h"
#include "test/mac/mach_multiprocess.h"
+#include "test/paths.h"
#include "util/file/file_io.h"
#include "util/mac/mac_util.h"
#include "util/mach/exc_server_variants.h"
@@ -45,6 +47,11 @@ namespace crashpad {
namespace test {
namespace {
+//! \return The path to the crashpad_snapshot_test_no_op executable.
+base::FilePath NoOpExecutable() {
+ return base::FilePath(Paths::Executable().value() + "_no_op");
+}
+
class TestMachOImageAnnotationsReader final
: public MachMultiprocess,
public UniversalMachExcServer::Interface {
@@ -304,9 +311,14 @@ class TestMachOImageAnnotationsReader final
// The actual executable doesn’t matter very much, because dyld won’t
// ever launch it. It just needs to be an executable that uses dyld as
- // its LC_LOAD_DYLINKER (all normal executables do). /usr/bin/true is on
- // every system, so use it.
- ASSERT_EQ(0, execl("/usr/bin/true", "true", nullptr))
+ // its LC_LOAD_DYLINKER (all normal executables do). A custom no-op
+ // executable is provided because DYLD_INSERT_LIBRARIES does not work
+ // with system executables on OS X 10.11 due to System Integrity
+ // Protection.
+ base::FilePath no_op_executable = NoOpExecutable();
+ ASSERT_EQ(0, execl(no_op_executable.value().c_str(),
+ no_op_executable.BaseName().value().c_str(),
+ nullptr))
<< ErrnoMessage("execl");
break;
}
« no previous file with comments | « no previous file | snapshot/mac/mach_o_image_annotations_reader_test_no_op.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698