Loading debuggerd/crash_dump.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ int main(int argc, char** argv) { info.siginfo = &siginfo; info.signo = info.siginfo->si_signo; info.executable_name = get_executable_name(g_target_thread); info.command_line = get_command_line(g_target_thread); } else { info.registers.reset(unwindstack::Regs::RemoteGet(thread)); Loading debuggerd/debuggerd_test.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <dirent.h> #include <dlfcn.h> #include <err.h> #include <errno.h> #include <fcntl.h> #include <inttypes.h> #include <linux/prctl.h> Loading @@ -24,6 +25,7 @@ #include <pthread.h> #include <setjmp.h> #include <stdlib.h> #include <string.h> #include <sys/capability.h> #include <sys/mman.h> #include <sys/prctl.h> Loading Loading @@ -3437,3 +3439,33 @@ TEST_F(CrasherTest, log_with_with_special_printable_ascii) { EXPECT_TRUE(result.find(" after", pos + 1) != std::string::npos) << "Couldn't find sanitized log message: " << result; } TEST_F(CrasherTest, executable) { SKIP_WITH_HWASAN << "prctl(PR_SET_MM, PR_SET_MM_ARG_{START,END} not supported on hwasan."; int intercept_result; unique_fd output_fd; StartProcess([]() { const char command_line[] = "TestCommand"; EXPECT_EQ(0, prctl(PR_SET_MM, PR_SET_MM_ARG_START, reinterpret_cast<unsigned long>(command_line), 0, 0)) << strerror(errno); EXPECT_EQ(0, prctl(PR_SET_MM, PR_SET_MM_ARG_END, reinterpret_cast<unsigned long>(&command_line[sizeof(command_line) - 1]), 0, 0)) << strerror(errno); abort(); }); StartIntercept(&output_fd); FinishCrasher(); AssertDeath(SIGABRT); FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; std::string result; ConsumeFd(std::move(output_fd), &result); ASSERT_MATCH(result, R"(Executable: \S*debuggerd_test\S*\n)"); ASSERT_MATCH(result, R"(Cmdline: TestCommand\n)"); } debuggerd/libdebuggerd/include/libdebuggerd/types.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ struct ThreadInfo { pid_t pid; std::string executable_name; std::vector<std::string> command_line; std::string selinux_label; Loading debuggerd/libdebuggerd/tombstone.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_m log.amfd_data = nullptr; std::string thread_name = get_thread_name(target_tid); std::string executable_name = get_executable_name(target_tid); std::vector<std::string> command_line = get_command_line(pid); std::unique_ptr<unwindstack::Regs> regs( Loading @@ -75,9 +76,16 @@ void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_m std::map<pid_t, ThreadInfo> threads; threads[target_tid] = ThreadInfo{ .registers = std::move(regs), .uid = uid, .tid = target_tid, .thread_name = std::move(thread_name), .pid = pid, .command_line = std::move(command_line), .selinux_label = std::move(selinux_label), .siginfo = siginfo, .signo = siginfo->si_signo, .registers = std::move(regs), .uid = uid, .tid = target_tid, .thread_name = std::move(thread_name), .pid = pid, .executable_name = std::move(executable_name), .command_line = std::move(command_line), .selinux_label = std::move(selinux_label), .siginfo = siginfo, .signo = siginfo->si_signo, // Only supported on aarch64 for now. #if defined(__aarch64__) .tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0), Loading debuggerd/libdebuggerd/tombstone_proto.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -875,6 +875,7 @@ void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::AndroidUnwinder* result.set_page_size(getpagesize()); result.set_has_been_16kb_mode(android::base::GetBoolProperty("ro.misctrl.16kb_before", false)); result.set_executable_name(target_thread.executable_name); auto cmd_line = result.mutable_command_line(); for (const auto& arg : target_thread.command_line) { *cmd_line->Add() = arg; Loading Loading
debuggerd/crash_dump.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ int main(int argc, char** argv) { info.siginfo = &siginfo; info.signo = info.siginfo->si_signo; info.executable_name = get_executable_name(g_target_thread); info.command_line = get_command_line(g_target_thread); } else { info.registers.reset(unwindstack::Regs::RemoteGet(thread)); Loading
debuggerd/debuggerd_test.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <dirent.h> #include <dlfcn.h> #include <err.h> #include <errno.h> #include <fcntl.h> #include <inttypes.h> #include <linux/prctl.h> Loading @@ -24,6 +25,7 @@ #include <pthread.h> #include <setjmp.h> #include <stdlib.h> #include <string.h> #include <sys/capability.h> #include <sys/mman.h> #include <sys/prctl.h> Loading Loading @@ -3437,3 +3439,33 @@ TEST_F(CrasherTest, log_with_with_special_printable_ascii) { EXPECT_TRUE(result.find(" after", pos + 1) != std::string::npos) << "Couldn't find sanitized log message: " << result; } TEST_F(CrasherTest, executable) { SKIP_WITH_HWASAN << "prctl(PR_SET_MM, PR_SET_MM_ARG_{START,END} not supported on hwasan."; int intercept_result; unique_fd output_fd; StartProcess([]() { const char command_line[] = "TestCommand"; EXPECT_EQ(0, prctl(PR_SET_MM, PR_SET_MM_ARG_START, reinterpret_cast<unsigned long>(command_line), 0, 0)) << strerror(errno); EXPECT_EQ(0, prctl(PR_SET_MM, PR_SET_MM_ARG_END, reinterpret_cast<unsigned long>(&command_line[sizeof(command_line) - 1]), 0, 0)) << strerror(errno); abort(); }); StartIntercept(&output_fd); FinishCrasher(); AssertDeath(SIGABRT); FinishIntercept(&intercept_result); ASSERT_EQ(1, intercept_result) << "tombstoned reported failure"; std::string result; ConsumeFd(std::move(output_fd), &result); ASSERT_MATCH(result, R"(Executable: \S*debuggerd_test\S*\n)"); ASSERT_MATCH(result, R"(Cmdline: TestCommand\n)"); }
debuggerd/libdebuggerd/include/libdebuggerd/types.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ struct ThreadInfo { pid_t pid; std::string executable_name; std::vector<std::string> command_line; std::string selinux_label; Loading
debuggerd/libdebuggerd/tombstone.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_m log.amfd_data = nullptr; std::string thread_name = get_thread_name(target_tid); std::string executable_name = get_executable_name(target_tid); std::vector<std::string> command_line = get_command_line(pid); std::unique_ptr<unwindstack::Regs> regs( Loading @@ -75,9 +76,16 @@ void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_m std::map<pid_t, ThreadInfo> threads; threads[target_tid] = ThreadInfo{ .registers = std::move(regs), .uid = uid, .tid = target_tid, .thread_name = std::move(thread_name), .pid = pid, .command_line = std::move(command_line), .selinux_label = std::move(selinux_label), .siginfo = siginfo, .signo = siginfo->si_signo, .registers = std::move(regs), .uid = uid, .tid = target_tid, .thread_name = std::move(thread_name), .pid = pid, .executable_name = std::move(executable_name), .command_line = std::move(command_line), .selinux_label = std::move(selinux_label), .siginfo = siginfo, .signo = siginfo->si_signo, // Only supported on aarch64 for now. #if defined(__aarch64__) .tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0), Loading
debuggerd/libdebuggerd/tombstone_proto.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -875,6 +875,7 @@ void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::AndroidUnwinder* result.set_page_size(getpagesize()); result.set_has_been_16kb_mode(android::base::GetBoolProperty("ro.misctrl.16kb_before", false)); result.set_executable_name(target_thread.executable_name); auto cmd_line = result.mutable_command_line(); for (const auto& arg : target_thread.command_line) { *cmd_line->Add() = arg; Loading