Delete the checkin directory with the wrong context

http://aosp/1845900 creates the directory with the wrong permission
and context. And when we attempt to fix it in http://aosp/1860276, the
device would fail to boot if the device is already on the bad build.

As a temporarily fix, already delete that checkin directory in vold. And
we can revert the deletion when the droidfood daily polulation gets out
of the bad state.

Bug: 203742483
Test: Update from TP1A.211016.001 and make sure the boot doesn't fail
Change-Id: Iec74528c1fe0e5876acc601e5cd008f99852d269
This commit is contained in:
Tianjie 2021-10-21 15:16:49 -07:00 committed by Tianjie Xu
parent 9696432564
commit b2ee9e0771

View file

@ -213,10 +213,18 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla
prepare_apex_subdirs(sehandle, misc_ce_path); prepare_apex_subdirs(sehandle, misc_ce_path);
// Give gmscore (who runs in cache group) access to the checkin directory. Also provide // Give gmscore (who runs in cache group) access to the checkin directory. Also provide
// the user id to set the correct selinux mls_level. // the user id to set the correct selinux mls_level.
if (!prepare_dir_for_user(sehandle, 0770, AID_SYSTEM, AID_CACHE,
misc_ce_path + "/checkin", user_id)) {
// TODO(b/203742483) the checkin directory was created with the wrong permission &
// context. Delete the directory to get these devices out of the bad state. Revert
// the change once the droidfood population is on newer build.
LOG(INFO) << "Failed to prepare the checkin directory, deleting for recreation";
android::vold::DeleteDirContentsAndDir(misc_ce_path + "/checkin");
if (!prepare_dir_for_user(sehandle, 0770, AID_SYSTEM, AID_CACHE, if (!prepare_dir_for_user(sehandle, 0770, AID_SYSTEM, AID_CACHE,
misc_ce_path + "/checkin", user_id)) { misc_ce_path + "/checkin", user_id)) {
return false; return false;
} }
}
auto system_ce_path = android::vold::BuildDataSystemCePath(user_id); auto system_ce_path = android::vold::BuildDataSystemCePath(user_id);
if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, system_ce_path + "/backup")) { if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, system_ce_path + "/backup")) {