Loading debuggerd/libdebuggerd/tombstone_proto.cpp +13 −24 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/sysinfo.h> #include <time.h> #include <memory> Loading Loading @@ -596,14 +597,6 @@ static void dump_tags_around_fault_addr(Signal* signal, const Tombstone& tombsto } } static std::optional<uint64_t> read_uptime_secs() { std::string uptime; if (!android::base::ReadFileToString("/proc/uptime", &uptime)) { return {}; } return strtoll(uptime.c_str(), nullptr, 10); } void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwinder, const std::map<pid_t, ThreadInfo>& threads, pid_t target_thread, const ProcessInfo& process_info, const OpenFilesList* open_files) { Loading @@ -614,27 +607,23 @@ void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwind result.set_revision(android::base::GetProperty("ro.revision", "unknown")); result.set_timestamp(get_timestamp()); std::optional<uint64_t> system_uptime = read_uptime_secs(); if (system_uptime) { const ThreadInfo& main_thread = threads.at(target_thread); result.set_pid(main_thread.pid); result.set_tid(main_thread.tid); result.set_uid(main_thread.uid); result.set_selinux_label(main_thread.selinux_label); struct sysinfo si; sysinfo(&si); android::procinfo::ProcessInfo proc_info; std::string error; if (android::procinfo::GetProcessInfo(target_thread, &proc_info, &error)) { if (android::procinfo::GetProcessInfo(main_thread.pid, &proc_info, &error)) { uint64_t starttime = proc_info.starttime / sysconf(_SC_CLK_TCK); result.set_process_uptime(*system_uptime - starttime); result.set_process_uptime(si.uptime - starttime); } else { async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read process info: %s", error.c_str()); } } else { async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read /proc/uptime: %s", strerror(errno)); } const ThreadInfo& main_thread = threads.at(target_thread); result.set_pid(main_thread.pid); result.set_tid(main_thread.tid); result.set_uid(main_thread.uid); result.set_selinux_label(main_thread.selinux_label); auto cmd_line = result.mutable_command_line(); for (const auto& arg : main_thread.command_line) { Loading debuggerd/seccomp_policy/crash_dump.arm.policy +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading debuggerd/seccomp_policy/crash_dump.arm64.policy +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading debuggerd/seccomp_policy/crash_dump.policy.def +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 Loading debuggerd/seccomp_policy/crash_dump.x86.policy +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading Loading
debuggerd/libdebuggerd/tombstone_proto.cpp +13 −24 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/sysinfo.h> #include <time.h> #include <memory> Loading Loading @@ -596,14 +597,6 @@ static void dump_tags_around_fault_addr(Signal* signal, const Tombstone& tombsto } } static std::optional<uint64_t> read_uptime_secs() { std::string uptime; if (!android::base::ReadFileToString("/proc/uptime", &uptime)) { return {}; } return strtoll(uptime.c_str(), nullptr, 10); } void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwinder, const std::map<pid_t, ThreadInfo>& threads, pid_t target_thread, const ProcessInfo& process_info, const OpenFilesList* open_files) { Loading @@ -614,27 +607,23 @@ void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwind result.set_revision(android::base::GetProperty("ro.revision", "unknown")); result.set_timestamp(get_timestamp()); std::optional<uint64_t> system_uptime = read_uptime_secs(); if (system_uptime) { const ThreadInfo& main_thread = threads.at(target_thread); result.set_pid(main_thread.pid); result.set_tid(main_thread.tid); result.set_uid(main_thread.uid); result.set_selinux_label(main_thread.selinux_label); struct sysinfo si; sysinfo(&si); android::procinfo::ProcessInfo proc_info; std::string error; if (android::procinfo::GetProcessInfo(target_thread, &proc_info, &error)) { if (android::procinfo::GetProcessInfo(main_thread.pid, &proc_info, &error)) { uint64_t starttime = proc_info.starttime / sysconf(_SC_CLK_TCK); result.set_process_uptime(*system_uptime - starttime); result.set_process_uptime(si.uptime - starttime); } else { async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read process info: %s", error.c_str()); } } else { async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read /proc/uptime: %s", strerror(errno)); } const ThreadInfo& main_thread = threads.at(target_thread); result.set_pid(main_thread.pid); result.set_tid(main_thread.tid); result.set_uid(main_thread.uid); result.set_selinux_label(main_thread.selinux_label); auto cmd_line = result.mutable_command_line(); for (const auto& arg : main_thread.command_line) { Loading
debuggerd/seccomp_policy/crash_dump.arm.policy +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading
debuggerd/seccomp_policy/crash_dump.arm64.policy +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading
debuggerd/seccomp_policy/crash_dump.policy.def +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 Loading
debuggerd/seccomp_policy/crash_dump.x86.policy +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ getdents64: 1 faccessat: 1 recvmsg: 1 recvfrom: 1 sysinfo: 1 process_vm_readv: 1 tgkill: 1 rt_sigprocmask: 1 Loading