From 713ec25103fb601dd508f773a326d9fcd83f0e25 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 3 Aug 2020 08:43:43 -0700 Subject: [PATCH] libdebuggerd: do a to-do. Until 77fdb22cf686002dfba8a24cf36666d7257b3034, logd started as AID_ROOT and then dropped its privileges. Since then, there's been no reason to use string comparisons rather than checking the uid. Test: pkill -SEGV logd Test: treehugger Change-Id: Ia709f8f59cb0ab9abac7df84c96c701b5d0a83ea --- debuggerd/libdebuggerd/tombstone.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp index 2a1ca110b..7af99c94c 100644 --- a/debuggerd/libdebuggerd/tombstone.cpp +++ b/debuggerd/libdebuggerd/tombstone.cpp @@ -174,12 +174,8 @@ static void dump_signal_info(log_t* log, const ThreadInfo& thread_info, } static void dump_thread_info(log_t* log, const ThreadInfo& thread_info) { - // Deny logd, logd.reader, logd.writer, logd.auditd, logd.control ... - // TODO: Why is this controlled by thread name? - if (thread_info.thread_name == "logd" || - android::base::StartsWith(thread_info.thread_name, "logd.")) { - log->should_retrieve_logcat = false; - } + // Don't try to collect logs from the threads that implement the logging system itself. + if (thread_info.uid == AID_LOGD) log->should_retrieve_logcat = false; _LOG(log, logtype::HEADER, "pid: %d, tid: %d, name: %s >>> %s <<<\n", thread_info.pid, thread_info.tid, thread_info.thread_name.c_str(), thread_info.process_name.c_str());