Merge "Convert paths to lower filesystem paths during setupAppDir"

gugelfrei
Zimuzo Ezeozue 5 years ago committed by Android (Google) Code Review
commit a064500bf3

@ -815,13 +815,21 @@ int VolumeManager::setupAppDir(const std::string& path, const std::string& appDi
return -EINVAL;
}
// Convert paths to lower filesystem paths to avoid making FUSE requests for these reasons:
// 1. A FUSE request from vold puts vold at risk of hanging if the FUSE daemon is down
// 2. The FUSE daemon prevents requests on /mnt/user/0/emulated/<userid != 0> and a request
// on /storage/emulated/10 means /mnt/user/0/emulated/10
// TODO(b/146419093): Use lower filesystem paths that don't depend on sdcardfs
const std::string lowerPath = "/mnt/runtime/default/" + path.substr(9);
const std::string lowerAppDirRoot = "/mnt/runtime/default/" + appDirRoot.substr(9);
// First create the root which holds app dirs, if needed.
int ret = PrepareDirsFromRoot(appDirRoot, "/storage/", 0771, AID_MEDIA_RW, AID_MEDIA_RW);
int ret = PrepareDirsFromRoot(lowerAppDirRoot, "/mnt/runtime/default/", 0771, AID_MEDIA_RW, AID_MEDIA_RW);
if (ret != 0) {
return ret;
}
// Then, create app-specific dirs with the correct UID/GID
return PrepareDirsFromRoot(path, appDirRoot, 0770, appUid, AID_MEDIA_RW);
return PrepareDirsFromRoot(lowerPath, lowerAppDirRoot, 0770, appUid, AID_MEDIA_RW);
}
int VolumeManager::createObb(const std::string& sourcePath, const std::string& sourceKey,

Loading…
Cancel
Save