summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Samuel Johnson <samueldjohnson@google.com> 2025-01-02 15:08:54 -0800
committer Samuel Johnson <samueldjohnson@google.com> 2025-01-20 10:08:24 -0800
commit0b4d20d1075206be7b67576bf15a6747e50a54e7 (patch)
treedb35f7bb2f30b7f38298ea9deebf3425940b9172
parentc9e5f470b50b7953c8446e9e24e5d7c80d2ad4ae (diff)
Enable searching for mounted public volumes under any user
Currently, InstalldNativeServices when collecting mounted storage to invalidate, only looks for mounts under /mnt/pass_through/0. This means that public volumes mounted under users that aren't user 0 are never collected. This change ensures that all of these public volumes are collected by checking for /mnt/pass_through/0/emulated and for /mnt/pass_through/x/UUID, where x is an integer greater than or equal to 0 and UUID is of the format HHHH-HHHH, H being any uppercase letter or a digit. In this change, the regex checks for /emulated only under user 0 because /mnt/pass_through/x/emulated/10 points to the same thing regardless of the value of x, so only checking under user 0, which is always mounted, prevents killing the same mount twice. Test: atest ExternalStorageHostTest Fixes: 299996244 Flag: EXEMPT refactor Change-Id: Icb4fca7213f9e656594625a83ba16a7ffc8251fe
-rw-r--r--cmds/installd/InstalldNativeService.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 4486bd6d3e..db565513c9 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -119,7 +119,6 @@ static constexpr const char* kFuseProp = "persist.sys.fuse";
*/
static constexpr const char* kAppDataIsolationEnabledProperty = "persist.zygote.app_data_isolation";
static constexpr const char* kMntSdcardfs = "/mnt/runtime/default/";
-static constexpr const char* kMntFuse = "/mnt/pass_through/0/";
static std::atomic<bool> sAppDataIsolationEnabled(false);
@@ -3697,7 +3696,9 @@ binder::Status InstalldNativeService::invalidateMounts() {
std::getline(in, ignored);
if (android::base::GetBoolProperty(kFuseProp, false)) {
- if (target.find(kMntFuse) == 0) {
+ const std::regex kMntFuseRe =
+ std::regex(R"(^/mnt/pass_through/(0|[0-9]+/[A-Z0-9]{4}-[A-Z0-9]{4}).*)");
+ if (std::regex_match(target, kMntFuseRe)) {
LOG(DEBUG) << "Found storage mount " << source << " at " << target;
mStorageMounts[source] = target;
}