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
This commit is contained in:
Jing Ji
2021-07-22 12:28:04 -07:00
parent 61d71ccaae
commit e61bb742bf

View File

@@ -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);