Camera: Remove tid and pid from abort message
- Remove pid and tid from abort message
so it can be used to dupe watchdog bugs
that were triggered by the same call
- Monitor function name with std::string
to prevent any use-after-free issue
Bug: 279520262
Test: Tested manually
Change-Id: I0d6d11544caf68353afdbf4aa6ba6bfa086b36d4
diff --git a/services/camera/libcameraservice/CameraServiceWatchdog.cpp b/services/camera/libcameraservice/CameraServiceWatchdog.cpp
index e802ea3..1c1bd24 100644
--- a/services/camera/libcameraservice/CameraServiceWatchdog.cpp
+++ b/services/camera/libcameraservice/CameraServiceWatchdog.cpp
@@ -43,8 +43,7 @@
mTidMap[currentThreadId].cycles++;
if (mTidMap[currentThreadId].cycles >= mMaxCycles) {
- std::string abortMessage = getAbortMessage(getpid(), currentThreadId,
- mTidMap[currentThreadId].functionName);
+ std::string abortMessage = getAbortMessage(mTidMap[currentThreadId].functionName);
android_set_abort_message(abortMessage.c_str());
ALOGW("CameraServiceWatchdog triggering abort for pid: %d tid: %d", getpid(),
currentThreadId);
@@ -60,10 +59,9 @@
return true;
}
-std::string CameraServiceWatchdog::getAbortMessage(int pid, int tid, const char* functionName) {
+std::string CameraServiceWatchdog::getAbortMessage(const std::string& functionName) {
std::string res = "CameraServiceWatchdog triggering abort during "
- + std::string(functionName) + " | pid: " + std::to_string(pid)
- + " tid: " + std::to_string(tid);
+ + functionName;
return res;
}