diff options
author | Evgenii Stepanov <eugenis@google.com> | 2021-01-29 11:50:30 -0800 |
---|---|---|
committer | Evgenii Stepanov <eugenis@google.com> | 2021-02-01 20:00:53 +0000 |
commit | 2a55e1adbe02028bf0ceb47d2ab85d01a98f73fc (patch) | |
tree | 158a5083a4251e978506711cd3ff39a01fececbe | |
parent | b44cf2d71b76060e7cb78593699e1139df2d8fa2 (diff) |
Scale timeouts in debuggerd and llkd.
Respect ro.timeout_multiplier property. Some of these are required for
tombstone writing to work on MTE QEMU, the rest are done speculatively.
Test: add crashing code to system_server, observe the tombstone
Bug: 178231152
Change-Id: Ic86e494af571301df7af07d13a6c046a0da6bda7
-rw-r--r-- | debuggerd/crash_dump.cpp | 8 | ||||
-rw-r--r-- | debuggerd/tombstoned/intercept_manager.cpp | 5 | ||||
-rw-r--r-- | debuggerd/tombstoned/tombstoned.cpp | 4 | ||||
-rw-r--r-- | llkd/libllkd.cpp | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp index 51afcc280..68a43cffb 100644 --- a/debuggerd/crash_dump.cpp +++ b/debuggerd/crash_dump.cpp @@ -153,14 +153,14 @@ static bool activity_manager_notify(pid_t pid, int signal, const std::string& am } struct timeval tv = { - .tv_sec = 1, - .tv_usec = 0, + .tv_sec = 1 * android::base::TimeoutMultiplier(), + .tv_usec = 0, }; if (setsockopt(amfd.get(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) { PLOG(ERROR) << "failed to set send timeout on activity manager socket"; return false; } - tv.tv_sec = 3; // 3 seconds on handshake read + tv.tv_sec = 3 * android::base::TimeoutMultiplier(); // 3 seconds on handshake read if (setsockopt(amfd.get(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { PLOG(ERROR) << "failed to set receive timeout on activity manager socket"; return false; @@ -447,7 +447,7 @@ int main(int argc, char** argv) { // // Note: processes with many threads and minidebug-info can take a bit to // unwind, do not make this too small. b/62828735 - alarm(30); + alarm(30 * android::base::TimeoutMultiplier()); // Get the process name (aka cmdline). std::string process_name = get_process_name(g_target_thread); diff --git a/debuggerd/tombstoned/intercept_manager.cpp b/debuggerd/tombstoned/intercept_manager.cpp index 437639e3c..4d4646a33 100644 --- a/debuggerd/tombstoned/intercept_manager.cpp +++ b/debuggerd/tombstoned/intercept_manager.cpp @@ -26,6 +26,7 @@ #include <android-base/cmsg.h> #include <android-base/logging.h> +#include <android-base/properties.h> #include <android-base/unique_fd.h> #include "protocol.h" @@ -162,7 +163,7 @@ static void intercept_request_cb(evutil_socket_t sockfd, short ev, void* arg) { event_assign(intercept->intercept_event, intercept_manager->base, sockfd, EV_READ | EV_TIMEOUT, intercept_close_cb, arg); - struct timeval timeout = { .tv_sec = 10, .tv_usec = 0 }; + struct timeval timeout = {.tv_sec = 10 * android::base::TimeoutMultiplier(), .tv_usec = 0}; event_add(intercept->intercept_event, &timeout); } @@ -178,7 +179,7 @@ static void intercept_accept_cb(evconnlistener* listener, evutil_socket_t sockfd intercept->intercept_manager = static_cast<InterceptManager*>(arg); intercept->sockfd.reset(sockfd); - struct timeval timeout = { 1, 0 }; + struct timeval timeout = {1 * android::base::TimeoutMultiplier(), 0}; event_base* base = evconnlistener_get_base(listener); event* intercept_event = event_new(base, sockfd, EV_TIMEOUT | EV_READ, intercept_request_cb, intercept); diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp index f057260e1..3e0c47c94 100644 --- a/debuggerd/tombstoned/tombstoned.cpp +++ b/debuggerd/tombstoned/tombstoned.cpp @@ -320,7 +320,7 @@ static void perform_request(std::unique_ptr<Crash> crash) { } // TODO: Make this configurable by the interceptor? - struct timeval timeout = {10, 0}; + struct timeval timeout = {10 * android::base::TimeoutMultiplier(), 0}; event_base* base = event_get_base(crash->crash_event); @@ -340,7 +340,7 @@ static void crash_accept_cb(evconnlistener* listener, evutil_socket_t sockfd, so // TODO: Make sure that only java crashes come in on the java socket // and only native crashes on the native socket. - struct timeval timeout = { 1, 0 }; + struct timeval timeout = {1 * android::base::TimeoutMultiplier(), 0}; event* crash_event = event_new(base, sockfd, EV_TIMEOUT | EV_READ, crash_request_cb, crash); crash->crash_socket_fd.reset(sockfd); crash->crash_event = crash_event; diff --git a/llkd/libllkd.cpp b/llkd/libllkd.cpp index a24d900dc..9f3e21829 100644 --- a/llkd/libllkd.cpp +++ b/llkd/libllkd.cpp @@ -962,7 +962,7 @@ milliseconds llkCheck(bool checkRunning) { // // This alarm is effectively the live lock detection of llkd, as // we understandably can not monitor ourselves otherwise. - ::alarm(duration_cast<seconds>(llkTimeoutMs * 2).count()); + ::alarm(duration_cast<seconds>(llkTimeoutMs * 2 * android::base::TimeoutMultiplier()).count()); // kernel jiffy precision fastest acquisition static timespec last; |