In MountEmulatedStorage() do not try to mount for mode MOUNT_EXTERNAL_NONE.
When creating an isolatedProcess=true service and when the native bridge
is in use, MountEmulatedStorage() is called with force_mount_namespace=true
and MOUNT_EXTERNAL_NONE. This led to an abort crash, since the process
would attempt to mount an empty path string.
Test: android.externalservice.cts.ExternalServiceTest built for ARM, run on Fugu
Bug: 36072260
Change-Id: I9441bcbd30167971ad486726bbeae57f3c4aebe9
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 90ad2da..ac9e636 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -346,6 +346,11 @@
return false;
}
+ // Handle force_mount_namespace with MOUNT_EXTERNAL_NONE.
+ if (mount_mode == MOUNT_EXTERNAL_NONE) {
+ return true;
+ }
+
if (TEMP_FAILURE_RETRY(mount(storageSource.string(), "/storage",
NULL, MS_BIND | MS_REC | MS_SLAVE, NULL)) == -1) {
ALOGW("Failed to mount %s to /storage: %s", storageSource.string(), strerror(errno));