Give installers the /mnt/installer view when using FUSE.

This is the same as /mnt/user, with the exception that Android/obb is
completely writable.

Bug: 134706060
Test: atest AdoptableHostTest
Change-Id: I8bf71f4dde9d2a4c6d02e6ff976f801831c50728
This commit is contained in:
Martijn Coenen
2020-01-11 19:45:08 +01:00
parent 3fa3890183
commit 7d60e1694a
2 changed files with 7 additions and 5 deletions

View File

@@ -746,9 +746,6 @@ static void MountEmulatedStorage(uid_t uid, jint mount_mode,
const userid_t user_id = multiuser_get_user_id(uid);
const std::string user_source = StringPrintf("/mnt/user/%d", user_id);
const std::string pass_through_source = StringPrintf("/mnt/pass_through/%d", user_id);
bool isFuse = GetBoolProperty(kPropFuse, false);
// Shell is neither AID_ROOT nor AID_EVERYBODY. Since it equally needs 'execute' access to
// /mnt/user/0 to 'adb shell ls /sdcard' for instance, we set the uid bit of /mnt/user/0 to
// AID_SHELL. This gives shell access along with apps running as group everybody (user 0 apps)
@@ -757,9 +754,15 @@ static void MountEmulatedStorage(uid_t uid, jint mount_mode,
PrepareDir(user_source, 0710, user_id ? AID_ROOT : AID_SHELL,
multiuser_get_uid(user_id, AID_EVERYBODY), fail_fn);
bool isFuse = GetBoolProperty(kPropFuse, false);
if (isFuse) {
if (mount_mode == MOUNT_EXTERNAL_PASS_THROUGH) {
const std::string pass_through_source = StringPrintf("/mnt/pass_through/%d", user_id);
BindMount(pass_through_source, "/storage", fail_fn);
} else if (mount_mode == MOUNT_EXTERNAL_INSTALLER) {
const std::string installer_source = StringPrintf("/mnt/installer/%d", user_id);
BindMount(installer_source, "/storage", fail_fn);
} else {
BindMount(user_source, "/storage", fail_fn);
}

View File

@@ -1556,8 +1556,7 @@ public final class ProcessList {
throw e.rethrowAsRuntimeException();
}
int numGids = 3;
if (mountExternal == Zygote.MOUNT_EXTERNAL_INSTALLER
|| mountExternal == Zygote.MOUNT_EXTERNAL_ANDROID_WRITABLE) {
if (mountExternal == Zygote.MOUNT_EXTERNAL_ANDROID_WRITABLE) {
numGids++;
}
/*