Loading init/init_first_stage.cpp +12 −13 Original line number Original line Diff line number Diff line Loading @@ -232,7 +232,7 @@ bool FirstStageMount::MountPartitions() { bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devices_partition_names, bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devices_partition_names, bool* out_need_dm_verity) { bool* out_need_dm_verity) { std::string meta_partition; std::string verity_loc_device; *out_need_dm_verity = false; *out_need_dm_verity = false; for (auto fstab_rec : mount_fstab_recs_) { for (auto fstab_rec : mount_fstab_recs_) { Loading @@ -245,29 +245,28 @@ bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devic if (fs_mgr_is_verified(fstab_rec)) { if (fs_mgr_is_verified(fstab_rec)) { *out_need_dm_verity = true; *out_need_dm_verity = true; } } // Checks if verity metadata is on a separate partition and get partition // Checks if verity metadata is on a separate partition. Note that it is // name from the end of the ->verity_loc path. Verity state is not partition // not partition specific, so there must be only one additional partition // specific, so there must be only one additional partition that carries // that carries verity state. // verity state. if (fstab_rec->verity_loc) { if (fstab_rec->verity_loc) { if (meta_partition.empty()) { if (verity_loc_device.empty()) { meta_partition = basename(fstab_rec->verity_loc); verity_loc_device = fstab_rec->verity_loc; } else if (meta_partition != fstab_rec->verity_loc) { } else if (verity_loc_device != fstab_rec->verity_loc) { LOG(ERROR) << "More than one meta partition found: " << meta_partition << ", " LOG(ERROR) << "More than one verity_loc found: " << verity_loc_device << ", " << basename(fstab_rec->verity_loc); << fstab_rec->verity_loc; return false; return false; } } } } } } // Includes those fstab partitions and meta_partition (if any). // Includes the partition names of fstab records and verity_loc_device (if any). // Notes that fstab_rec->blk_device has A/B suffix updated by fs_mgr when A/B is used. // Notes that fstab_rec->blk_device has A/B suffix updated by fs_mgr when A/B is used. for (auto fstab_rec : mount_fstab_recs_) { for (auto fstab_rec : mount_fstab_recs_) { out_devices_partition_names->emplace(basename(fstab_rec->blk_device)); out_devices_partition_names->emplace(basename(fstab_rec->blk_device)); } } if (!meta_partition.empty()) { if (!verity_loc_device.empty()) { out_devices_partition_names->emplace(std::move(meta_partition)); out_devices_partition_names->emplace(basename(verity_loc_device.c_str())); } } return true; return true; Loading Loading
init/init_first_stage.cpp +12 −13 Original line number Original line Diff line number Diff line Loading @@ -232,7 +232,7 @@ bool FirstStageMount::MountPartitions() { bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devices_partition_names, bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devices_partition_names, bool* out_need_dm_verity) { bool* out_need_dm_verity) { std::string meta_partition; std::string verity_loc_device; *out_need_dm_verity = false; *out_need_dm_verity = false; for (auto fstab_rec : mount_fstab_recs_) { for (auto fstab_rec : mount_fstab_recs_) { Loading @@ -245,29 +245,28 @@ bool FirstStageMountVBootV1::GetRequiredDevices(std::set<std::string>* out_devic if (fs_mgr_is_verified(fstab_rec)) { if (fs_mgr_is_verified(fstab_rec)) { *out_need_dm_verity = true; *out_need_dm_verity = true; } } // Checks if verity metadata is on a separate partition and get partition // Checks if verity metadata is on a separate partition. Note that it is // name from the end of the ->verity_loc path. Verity state is not partition // not partition specific, so there must be only one additional partition // specific, so there must be only one additional partition that carries // that carries verity state. // verity state. if (fstab_rec->verity_loc) { if (fstab_rec->verity_loc) { if (meta_partition.empty()) { if (verity_loc_device.empty()) { meta_partition = basename(fstab_rec->verity_loc); verity_loc_device = fstab_rec->verity_loc; } else if (meta_partition != fstab_rec->verity_loc) { } else if (verity_loc_device != fstab_rec->verity_loc) { LOG(ERROR) << "More than one meta partition found: " << meta_partition << ", " LOG(ERROR) << "More than one verity_loc found: " << verity_loc_device << ", " << basename(fstab_rec->verity_loc); << fstab_rec->verity_loc; return false; return false; } } } } } } // Includes those fstab partitions and meta_partition (if any). // Includes the partition names of fstab records and verity_loc_device (if any). // Notes that fstab_rec->blk_device has A/B suffix updated by fs_mgr when A/B is used. // Notes that fstab_rec->blk_device has A/B suffix updated by fs_mgr when A/B is used. for (auto fstab_rec : mount_fstab_recs_) { for (auto fstab_rec : mount_fstab_recs_) { out_devices_partition_names->emplace(basename(fstab_rec->blk_device)); out_devices_partition_names->emplace(basename(fstab_rec->blk_device)); } } if (!meta_partition.empty()) { if (!verity_loc_device.empty()) { out_devices_partition_names->emplace(std::move(meta_partition)); out_devices_partition_names->emplace(basename(verity_loc_device.c_str())); } } return true; return true; Loading