From b185ac061645654f330543e6053dab2d77191747 Mon Sep 17 00:00:00 2001 From: Hang Lu Date: Wed, 24 Mar 2021 13:17:22 +0800 Subject: libbinder: support BR_ONEWAY_SPAM_SUSPECT This command tells userspace to dump current stack, which happened when oneway spamming is detected in kernel. And also add an ioctl command BINDER_ENABLE_ONEWAY_SPAM_DETECTION to enable/disable this feature per-proc. Bug: 181190340 Change-Id: I7afb1df46a4fbf59bc69b56649aa3ee779dfea5a --- libs/binder/IPCThreadState.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs/binder/IPCThreadState.cpp') diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index 406bd54e6f..6fb1227f63 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -90,6 +90,8 @@ static const char *kReturnStrings[] = { "BR_DEAD_BINDER", "BR_CLEAR_DEATH_NOTIFICATION_DONE", "BR_FAILED_REPLY", + "BR_FROZEN_REPLY", + "BR_ONEWAY_SPAM_SUSPECT", "BR_TRANSACTION_SEC_CTX", }; @@ -894,6 +896,11 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) } switch (cmd) { + case BR_ONEWAY_SPAM_SUSPECT: + ALOGE("Process seems to be sending too many oneway calls."); + CallStack::logStack("oneway spamming", CallStack::getCurrent().get(), + ANDROID_LOG_ERROR); + [[fallthrough]]; case BR_TRANSACTION_COMPLETE: if (!reply && !acquireResult) goto finish; break; -- cgit v1.2.3-59-g8ed1b