Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06f39306 authored by Robert Sesek's avatar Robert Sesek
Browse files

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
parent cb4a3c55
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -346,6 +346,11 @@ static bool MountEmulatedStorage(uid_t uid, jint mount_mode,
        return false;
        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",
    if (TEMP_FAILURE_RETRY(mount(storageSource.string(), "/storage",
            NULL, MS_BIND | MS_REC | MS_SLAVE, NULL)) == -1) {
            NULL, MS_BIND | MS_REC | MS_SLAVE, NULL)) == -1) {
        ALOGW("Failed to mount %s to /storage: %s", storageSource.string(), strerror(errno));
        ALOGW("Failed to mount %s to /storage: %s", storageSource.string(), strerror(errno));