Use /data/misc/apexdata for the list of APEXes
vold_prepare_subdirs should create apexdata directories for each APEX. Previously, it gets the list by scanning /apex directory. However, vold/vold_prepare_subdirs run in the bootstrap mount namespace, they can see only bootstrap apexes in /apex. The reason why it worked was that unintended side effects of how we managed /apex directory for both mount namespace. Instead, since apexdata directories are already populated by init in /data/misc/apexdata, we can use that directory for the same purpose. Bug: 295345486 Test: CtsPackageSettingHostTestCases Change-Id: I453cd59f54ccbb140f73b5e8576b36fa49f9bc59
This commit is contained in:
parent
6d07925510
commit
64d727c503
1 changed files with 6 additions and 3 deletions
|
@ -144,7 +144,12 @@ static bool rmrf_contents(const std::string& path) {
|
||||||
static bool prepare_apex_subdirs(struct selabel_handle* sehandle, const std::string& path) {
|
static bool prepare_apex_subdirs(struct selabel_handle* sehandle, const std::string& path) {
|
||||||
if (!prepare_dir(sehandle, 0711, 0, 0, path + "/apexdata")) return false;
|
if (!prepare_dir(sehandle, 0711, 0, 0, path + "/apexdata")) return false;
|
||||||
|
|
||||||
auto dirp = std::unique_ptr<DIR, int (*)(DIR*)>(opendir("/apex"), closedir);
|
// Since vold/vold_prepare_subdirs run in the bootstrap mount namespace
|
||||||
|
// we can't get the full list of APEXes by scanning /apex directory.
|
||||||
|
// Instead, we can look up /data/misc/apexdata for the list of APEXes,
|
||||||
|
// which is populated during `perform_apex_config` in init.
|
||||||
|
// Note: `init_user0` should be invoked after `perform_apex_config`.
|
||||||
|
auto dirp = std::unique_ptr<DIR, int (*)(DIR*)>(opendir("/data/misc/apexdata"), closedir);
|
||||||
if (!dirp) {
|
if (!dirp) {
|
||||||
PLOG(ERROR) << "Unable to open apex directory";
|
PLOG(ERROR) << "Unable to open apex directory";
|
||||||
return false;
|
return false;
|
||||||
|
@ -157,8 +162,6 @@ static bool prepare_apex_subdirs(struct selabel_handle* sehandle, const std::str
|
||||||
// skip any starting with "."
|
// skip any starting with "."
|
||||||
if (name[0] == '.') continue;
|
if (name[0] == '.') continue;
|
||||||
|
|
||||||
if (strchr(name, '@') != NULL) continue;
|
|
||||||
|
|
||||||
if (!prepare_dir(sehandle, 0771, AID_ROOT, AID_SYSTEM, path + "/apexdata/" + name)) {
|
if (!prepare_dir(sehandle, 0771, AID_ROOT, AID_SYSTEM, path + "/apexdata/" + name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue