From e61bb742bfc7e7d51df7c95e9e8720e38cb837c9 Mon Sep 17 00:00:00 2001 From: Jing Ji Date: Thu, 22 Jul 2021 12:28:04 -0700 Subject: [PATCH] Fix potential FD leak with PhantomProcessRecord bookkeeping We're tracking the phantom processes with the combination of its process name and pid/uid, while if the process name changes it'll be removed from the internal bookkeping, we should close the FD to that process upon then. Bug: 194146206 Test: atest AppChildProcessTest Test: atest CtsAppTestCases:ActivityManagerTest Change-Id: I62064afe55aa8bc51a2d523bc5d8fe6e97f171a8 --- .../core/java/com/android/server/am/PhantomProcessList.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/PhantomProcessList.java b/services/core/java/com/android/server/am/PhantomProcessList.java index 4f3438fe8706a..ca31681616051 100644 --- a/services/core/java/com/android/server/am/PhantomProcessList.java +++ b/services/core/java/com/android/server/am/PhantomProcessList.java @@ -305,7 +305,7 @@ public final class PhantomProcessList { } // Somehow our record doesn't match, remove it anyway Slog.w(TAG, "Stale " + proc + ", removing"); - mPhantomProcesses.removeAt(index); + onPhantomProcessKilledLocked(proc); } else { // Is this one of the zombie processes we've known? final int idx = mZombiePhantomProcesses.indexOfKey(pid);