summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalesh Singh <kaleshsingh@google.com>2020-07-13 14:42:09 +0000
committerKalesh Singh <kaleshsingh@google.com>2020-07-14 17:29:30 +0000
commitce3c6a66c4eb98428d3afa471de550b4181fb4e9 (patch)
tree50b99c4ffca0c40245fbd42f45dec7391a1a7eba
parent1d683920e4229de302ff5d698536d7c0abf71c60 (diff)
downloadplatform_system_hardware_interfaces-android11-dev.tar.gz
platform_system_hardware_interfaces-android11-dev.tar.bz2
platform_system_hardware_interfaces-android11-dev.zip
Ignore SIGPIPE when dumping stats from SystemSuspendandroid-cts-11.0_r2android11-dev
SuspendControlService dumps wakelock and suspend stats via dumpsys. If dumpsys closes the reading end of the pipe (likely due to timeout) and SuspendControlService attempts to write to the fd it received form dumpsys, the processreceives sig 13 (SIGPIPE), and is then killed. System suspend is a critical process and should not be killed for a failure to dump stats. If System suspend dies binder sends a failed response for any ongoing wakelock binder trasactions. This leads to the unchecked failed HIDL return, which causes an ABORT. Bug: 160741383 Test: SystemSuspendV1_0UnitTest Change-Id: I4f2ff7fc14b6fbeda2098f798f7c526580b17ce9 (cherry picked from commit 303520bd3f4f16c3dcc180851622f8cb3b84d2e0)
-rw-r--r--suspend/1.0/default/SuspendControlService.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/suspend/1.0/default/SuspendControlService.cpp b/suspend/1.0/default/SuspendControlService.cpp
index 2a4748b7..671f3dd8 100644
--- a/suspend/1.0/default/SuspendControlService.cpp
+++ b/suspend/1.0/default/SuspendControlService.cpp
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
+#include <signal.h>
#include "SystemSuspend.h"
@@ -29,6 +30,10 @@ namespace system {
namespace suspend {
namespace V1_0 {
+static void register_sig_handler() {
+ signal(SIGPIPE, SIG_IGN);
+}
+
template <typename T>
binder::Status retOk(const T& value, T* ret_val) {
*ret_val = value;
@@ -113,6 +118,8 @@ static std::string dumpUsage() {
}
status_t SuspendControlService::dump(int fd, const Vector<String16>& args) {
+ register_sig_handler();
+
const auto suspendService = mSuspend.promote();
if (!suspendService) {
return DEAD_OBJECT;