installd: Wait indefinitely for the subprocess if pidfd_open fails.
In Android T we introduced a feature in installd, which is to kill the
subprocess that times out. This feature is implemented by a syscall
pidfd_open, which requires kernel 5.4 or above, so it fails on older
kernels, and therefore causes installd unable to invoke dex2oat, etc.,
making the device unable to do any app compilation.
After this change, if pidfd_open fails, installd will wait indefinitely
for the subprocess, which is the behavior in Android S.
Bug: 238316970
Test: Presubmit
Change-Id: I12e492937b876b5b312b3f8eedce6e5d5d2a4a4e
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index c7bea3f..65b25a4 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -1182,8 +1182,8 @@
int wait_child_with_timeout(pid_t pid, int timeout_ms) {
int pidfd = pidfd_open(pid, /*flags=*/0);
if (pidfd < 0) {
- PLOG(ERROR) << "pidfd_open failed for pid " << pid;
- kill(pid, SIGKILL);
+ PLOG(ERROR) << "pidfd_open failed for pid " << pid
+ << ", waiting for child process without timeout";
return wait_child(pid);
}