Do not read ro.apex.updatable.

We no longer support ro.apex.updatable=false case. Hence no need to read
it.

Bug: 297460439
Test: device boots
Change-Id: I9b71ea96052741073f092ca6abcfbe92a927128a
This commit is contained in:
Jooyung Han 2023-08-25 15:38:12 +09:00
parent f05039392c
commit a9f2171c42
2 changed files with 13 additions and 20 deletions

View file

@ -165,7 +165,6 @@ cc_library_static {
}, },
}, },
whole_static_libs: [ whole_static_libs: [
"libcom.android.sysprop.apex",
"libc++fs", "libc++fs",
], ],
} }

View file

@ -35,7 +35,6 @@
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <ApexProperties.sysprop.h>
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/logging.h> #include <android-base/logging.h>
#include <android-base/parseint.h> #include <android-base/parseint.h>
@ -595,12 +594,11 @@ bool scanProcProcesses(uid_t uid, userid_t userId, ScanProcCallback callback, vo
struct dirent* de; struct dirent* de;
std::string rootName; std::string rootName;
std::string pidName; std::string pidName;
std::string exeName;
int pidFd; int pidFd;
int nsFd; int nsFd;
struct stat sb; struct stat sb;
static bool apexUpdatable = android::sysprop::ApexProperties::updatable().value_or(false);
if (!(dir = opendir("/proc"))) { if (!(dir = opendir("/proc"))) {
async_safe_format_log(ANDROID_LOG_ERROR, "vold", "Failed to opendir"); async_safe_format_log(ANDROID_LOG_ERROR, "vold", "Failed to opendir");
return false; return false;
@ -648,22 +646,18 @@ bool scanProcProcesses(uid_t uid, userid_t userId, ScanProcCallback callback, vo
goto next; goto next;
} }
if (apexUpdatable) { // Some early native processes have mount namespaces that are different
std::string exeName; // from that of the init. Therefore, above check can't filter them out.
// When ro.apex.bionic_updatable is set to true, // Since the propagation type of / is 'shared', unmounting /storage
// some early native processes have mount namespaces that are different // for the early native processes affects other processes including
// from that of the init. Therefore, above check can't filter them out. // init. Filter out such processes by skipping if a process is a
// Since the propagation type of / is 'shared', unmounting /storage // non-Java process whose UID is < AID_APP_START. (The UID condition
// for the early native processes affects other processes including // is required to not filter out child processes spawned by apps.)
// init. Filter out such processes by skipping if a process is a if (!android::vold::Readlinkat(pidFd, "exe", &exeName)) {
// non-Java process whose UID is < AID_APP_START. (The UID condition goto next;
// is required to not filter out child processes spawned by apps.) }
if (!android::vold::Readlinkat(pidFd, "exe", &exeName)) { if (!StartsWith(exeName, "/system/bin/app_process") && sb.st_uid < AID_APP_START) {
goto next; goto next;
}
if (!StartsWith(exeName, "/system/bin/app_process") && sb.st_uid < AID_APP_START) {
goto next;
}
} }
// We purposefully leave the namespace open across the fork // We purposefully leave the namespace open across the fork