From 6d90e403303f989918f0dd86d094f75b761c23f8 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 27 Mar 2023 20:42:33 +0000 Subject: [PATCH] binder - include calling PID/UID in uncaught remote exception code Bug: 150808347 Change-Id: I7c8e69e1f71910b7e1358b91646b23380cce74a3 Test: N/A --- core/jni/android_util_Binder.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index a7c7d0ba35bcd..b24dc8a9e63b5 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -413,9 +413,13 @@ protected: if (env->ExceptionCheck()) { ScopedLocalRef excep(env, env->ExceptionOccurred()); - binder_report_exception(env, excep.get(), - "*** Uncaught remote exception! " - "(Exceptions are not yet supported across processes.)"); + + auto state = IPCThreadState::self(); + String8 msg; + msg.appendFormat("*** Uncaught remote exception! Exceptions are not yet supported " + "across processes. Client PID %d UID %d.", + state->getCallingPid(), state->getCallingUid()); + binder_report_exception(env, excep.get(), msg.c_str()); res = JNI_FALSE; } @@ -431,6 +435,7 @@ protected: ScopedLocalRef excep(env, env->ExceptionOccurred()); binder_report_exception(env, excep.get(), "*** Uncaught exception in onBinderStrictModePolicyChange"); + // TODO: should turn this to fatal? } // Need to always call through the native implementation of