From a9f2171c42689555f1a31f58c48ad58d4553e80a Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 25 Aug 2023 15:38:12 +0900 Subject: [PATCH] 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 --- Android.bp | 1 - VolumeManager.cpp | 32 +++++++++++++------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Android.bp b/Android.bp index 7e41f22..6d70d4d 100644 --- a/Android.bp +++ b/Android.bp @@ -165,7 +165,6 @@ cc_library_static { }, }, whole_static_libs: [ - "libcom.android.sysprop.apex", "libc++fs", ], } diff --git a/VolumeManager.cpp b/VolumeManager.cpp index dc6fae9..ac1c54a 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -35,7 +35,6 @@ #include -#include #include #include #include @@ -595,12 +594,11 @@ bool scanProcProcesses(uid_t uid, userid_t userId, ScanProcCallback callback, vo struct dirent* de; std::string rootName; std::string pidName; + std::string exeName; int pidFd; int nsFd; struct stat sb; - static bool apexUpdatable = android::sysprop::ApexProperties::updatable().value_or(false); - if (!(dir = opendir("/proc"))) { async_safe_format_log(ANDROID_LOG_ERROR, "vold", "Failed to opendir"); return false; @@ -648,22 +646,18 @@ bool scanProcProcesses(uid_t uid, userid_t userId, ScanProcCallback callback, vo goto next; } - if (apexUpdatable) { - std::string exeName; - // When ro.apex.bionic_updatable is set to true, - // some early native processes have mount namespaces that are different - // from that of the init. Therefore, above check can't filter them out. - // Since the propagation type of / is 'shared', unmounting /storage - // for the early native processes affects other processes including - // init. Filter out such processes by skipping if a process is a - // non-Java process whose UID is < AID_APP_START. (The UID condition - // is required to not filter out child processes spawned by apps.) - if (!android::vold::Readlinkat(pidFd, "exe", &exeName)) { - goto next; - } - if (!StartsWith(exeName, "/system/bin/app_process") && sb.st_uid < AID_APP_START) { - goto next; - } + // Some early native processes have mount namespaces that are different + // from that of the init. Therefore, above check can't filter them out. + // Since the propagation type of / is 'shared', unmounting /storage + // for the early native processes affects other processes including + // init. Filter out such processes by skipping if a process is a + // non-Java process whose UID is < AID_APP_START. (The UID condition + // is required to not filter out child processes spawned by apps.) + if (!android::vold::Readlinkat(pidFd, "exe", &exeName)) { + 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