summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorDavid Anderson2018-07-18 19:02:07 -0500
committerDavid Anderson2018-07-19 16:38:27 -0500
commitab8414dd6c91562f45c22367df6492181e491d43 (patch)
tree8ebba6dce797d2333bf39d93344059f466311b1c /init
parent9555f3dcf6f284348f70feef3c185df8a7d5773c (diff)
downloadplatform-system-core-ab8414dd6c91562f45c22367df6492181e491d43.tar.gz
platform-system-core-ab8414dd6c91562f45c22367df6492181e491d43.tar.xz
platform-system-core-ab8414dd6c91562f45c22367df6492181e491d43.zip
init: Don't look for logical partitions via uevents.
When using AVB, init's first stage regenerates uevent to find the paths of block devices for verified partitions. If it can't find them all, it will panic, causing the device to boot to recovery. This does not work with logical partitions, since devices for those partitions are created later in the first stage. In fact, they cannot be created until uevent regeneration completes, since logical partitions are are created by finding the "super" partition. To address this we exclude logical partitions (as marked in fstab) from the device finding process. Note that partitions moved from GPT to liblp will no longer appear in by_name_symlink_map_. Bug: 79173901 Test: AVB 2.0 device boots after deleting the vendor partition, creating a super partition, and flashing it with a dynamic vendor partition. Change-Id: I19371b05912240480dc50864a2c04131258a7103
Diffstat (limited to 'init')
-rw-r--r--init/init_first_stage.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/init/init_first_stage.cpp b/init/init_first_stage.cpp
index 2bc9f3ae0..a24a9a239 100644
--- a/init/init_first_stage.cpp
+++ b/init/init_first_stage.cpp
@@ -456,12 +456,19 @@ FirstStageMountVBootV2::FirstStageMountVBootV2() : avb_handle_(nullptr) {
456bool FirstStageMountVBootV2::GetDmVerityDevices() { 456bool FirstStageMountVBootV2::GetDmVerityDevices() {
457 need_dm_verity_ = false; 457 need_dm_verity_ = false;
458 458
459 std::set<std::string> logical_partitions;
460
459 // fstab_rec->blk_device has A/B suffix. 461 // fstab_rec->blk_device has A/B suffix.
460 for (auto fstab_rec : mount_fstab_recs_) { 462 for (auto fstab_rec : mount_fstab_recs_) {
461 if (fs_mgr_is_avb(fstab_rec)) { 463 if (fs_mgr_is_avb(fstab_rec)) {
462 need_dm_verity_ = true; 464 need_dm_verity_ = true;
463 } 465 }
464 required_devices_partition_names_.emplace(basename(fstab_rec->blk_device)); 466 if (fs_mgr_is_logical(fstab_rec)) {
467 // Don't try to find logical partitions via uevent regeneration.
468 logical_partitions.emplace(basename(fstab_rec->blk_device));
469 } else {
470 required_devices_partition_names_.emplace(basename(fstab_rec->blk_device));
471 }
465 } 472 }
466 473
467 // libavb verifies AVB metadata on all verified partitions at once. 474 // libavb verifies AVB metadata on all verified partitions at once.
@@ -476,11 +483,15 @@ bool FirstStageMountVBootV2::GetDmVerityDevices() {
476 std::vector<std::string> partitions = android::base::Split(device_tree_vbmeta_parts_, ","); 483 std::vector<std::string> partitions = android::base::Split(device_tree_vbmeta_parts_, ",");
477 std::string ab_suffix = fs_mgr_get_slot_suffix(); 484 std::string ab_suffix = fs_mgr_get_slot_suffix();
478 for (const auto& partition : partitions) { 485 for (const auto& partition : partitions) {
486 std::string partition_name = partition + ab_suffix;
487 if (logical_partitions.count(partition_name)) {
488 continue;
489 }
479 // required_devices_partition_names_ is of type std::set so it's not an issue 490 // required_devices_partition_names_ is of type std::set so it's not an issue
480 // to emplace a partition twice. e.g., /vendor might be in both places: 491 // to emplace a partition twice. e.g., /vendor might be in both places:
481 // - device_tree_vbmeta_parts_ = "vbmeta,boot,system,vendor" 492 // - device_tree_vbmeta_parts_ = "vbmeta,boot,system,vendor"
482 // - mount_fstab_recs_: /vendor_a 493 // - mount_fstab_recs_: /vendor_a
483 required_devices_partition_names_.emplace(partition + ab_suffix); 494 required_devices_partition_names_.emplace(partition_name);
484 } 495 }
485 } 496 }
486 return true; 497 return true;