Index: lib/asan/asan_flags.h =================================================================== --- lib/asan/asan_flags.h +++ lib/asan/asan_flags.h @@ -52,7 +52,6 @@ bool print_stats; bool print_legend; bool atexit; - bool allow_reexec; bool print_full_thread_history; bool poison_heap; bool poison_partial; Index: lib/asan/asan_flags.cc =================================================================== --- lib/asan/asan_flags.cc +++ lib/asan/asan_flags.cc @@ -113,10 +113,6 @@ "If set, prints ASan exit stats even after program terminates " "successfully."); - ParseFlag(str, &f->allow_reexec, "allow_reexec", - "Allow the tool to re-exec the program. This may interfere badly with " - "the debugger."); - ParseFlag(str, &f->print_full_thread_history, "print_full_thread_history", "If set, prints thread creation stacks for the threads involved in the " @@ -209,7 +205,6 @@ f->print_stats = false; f->print_legend = true; f->atexit = false; - f->allow_reexec = true; f->print_full_thread_history = true; f->poison_heap = true; f->poison_array_cookie = true; Index: lib/asan/asan_mac.cc =================================================================== --- lib/asan/asan_mac.cc +++ lib/asan/asan_mac.cc @@ -102,7 +102,6 @@ } void MaybeReexec() { - if (!flags()->allow_reexec) return; // Make sure the dynamic ASan runtime library is preloaded so that the // wrappers work. If it is not, set DYLD_INSERT_LIBRARIES and re-exec // ourselves. @@ -140,8 +139,15 @@ VReport(1, "exec()-ing the program with\n"); VReport(1, "%s=%s\n", kDyldInsertLibraries, new_env); VReport(1, "to enable ASan wrappers.\n"); - VReport(1, "Set ASAN_OPTIONS=allow_reexec=0 to disable this.\n"); execv(program_name, *_NSGetArgv()); + + // We get here only if execv() failed. + Report("ERROR: The process is launched without DYLD_INSERT_LIBRARIES, " + "which is required for ASan to work. ASan tried to set the " + "environment variable and re-execute itself, but execv() failed, " + "possibly because of sandbox restrictions. Make sure to launch the " + "executable with:\n%s=%s\n", kDyldInsertLibraries, new_env); + CHECK("execv failed" && 0); } else { // DYLD_INSERT_LIBRARIES is set and contains the runtime library. if (old_env_len == fname_len) { Index: lib/asan/tests/asan_noinst_test.cc =================================================================== --- lib/asan/tests/asan_noinst_test.cc +++ lib/asan/tests/asan_noinst_test.cc @@ -31,15 +31,6 @@ // in this test. The static runtime library is linked explicitly (without // -fsanitize=address), thus the interceptors do not work correctly on OS X. -#if !defined(_WIN32) -extern "C" { -// Set specific ASan options for uninstrumented unittest. -const char* __asan_default_options() { - return "allow_reexec=0"; -} -} // extern "C" -#endif - // Make sure __asan_init is called before any test case is run. struct AsanInitCaller { AsanInitCaller() { __asan_init(); }