Loading debuggerd/debuggerd_test.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include <err.h> #include <fcntl.h> #include <stdlib.h> #include <sys/capability.h> #include <sys/prctl.h> #include <sys/ptrace.h> Loading Loading @@ -298,6 +299,26 @@ TEST_F(CrasherTest, smoke) { ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0xdead)"); } TEST_F(CrasherTest, LD_PRELOAD) { int intercept_result; unique_fd output_fd; StartProcess([]() { setenv("LD_PRELOAD", "nonexistent.so", 1); *reinterpret_cast<volatile char*>(0xdead) = '1'; }); StartIntercept(&output_fd); FinishCrasher(); AssertDeath(SIGSEGV); FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; std::string result; ConsumeFd(std::move(output_fd), &result); ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0xdead)"); } TEST_F(CrasherTest, abort) { int intercept_result; unique_fd output_fd; Loading debuggerd/handler/debuggerd_handler.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -330,8 +330,8 @@ static int debuggerd_dispatch_pseudothread(void* arg) { async_safe_format_buffer(debuggerd_dump_type, sizeof(debuggerd_dump_type), "%d", get_dump_type(thread_info)); execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, debuggerd_dump_type, nullptr); execle(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, debuggerd_dump_type, nullptr, nullptr); fatal_errno("exec failed"); } else { Loading Loading
debuggerd/debuggerd_test.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include <err.h> #include <fcntl.h> #include <stdlib.h> #include <sys/capability.h> #include <sys/prctl.h> #include <sys/ptrace.h> Loading Loading @@ -298,6 +299,26 @@ TEST_F(CrasherTest, smoke) { ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0xdead)"); } TEST_F(CrasherTest, LD_PRELOAD) { int intercept_result; unique_fd output_fd; StartProcess([]() { setenv("LD_PRELOAD", "nonexistent.so", 1); *reinterpret_cast<volatile char*>(0xdead) = '1'; }); StartIntercept(&output_fd); FinishCrasher(); AssertDeath(SIGSEGV); FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; std::string result; ConsumeFd(std::move(output_fd), &result); ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0xdead)"); } TEST_F(CrasherTest, abort) { int intercept_result; unique_fd output_fd; Loading
debuggerd/handler/debuggerd_handler.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -330,8 +330,8 @@ static int debuggerd_dispatch_pseudothread(void* arg) { async_safe_format_buffer(debuggerd_dump_type, sizeof(debuggerd_dump_type), "%d", get_dump_type(thread_info)); execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, debuggerd_dump_type, nullptr); execle(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, debuggerd_dump_type, nullptr, nullptr); fatal_errno("exec failed"); } else { Loading