diff options
author | David Zeuthen <zeuthen@google.com> | 2017-08-07 18:47:27 -0400 |
---|---|---|
committer | David Zeuthen <zeuthen@google.com> | 2017-08-09 14:23:20 -0400 |
commit | 3222dc0d76ca0f19795df2aad417dec2293b7242 (patch) | |
tree | e79127d4598a48191ffa776467aa13d7ca99dc68 | |
parent | 5e47d5161aef9778c527b734baa203bf32c65a49 (diff) | |
download | android_bootable_recovery-3222dc0d76ca0f19795df2aad417dec2293b7242.tar.gz android_bootable_recovery-3222dc0d76ca0f19795df2aad417dec2293b7242.tar.bz2 android_bootable_recovery-3222dc0d76ca0f19795df2aad417dec2293b7242.zip |
update_verifier: Support androidboot.veritymode being empty or 'disabled'.
Bootloaders using libavb will set androidboot.veritymode=disabled if
the "disable dm-verity" flag has been set. Additionally if the
"disable verification" flag is set androidboot.veritymode will not be
set at all. Handle both cases.
Without this fix we'll end up in a bootloop.
Test: Manually tested on a device using AVB.
(cherry-picked from commit 1a0929cc8aac532dba00b3c98cea22715719a421)
Bug: 64404283
Change-Id: I3adf93f8dfd528fe9b869a63afa775f5730a3f69
-rw-r--r-- | update_verifier/update_verifier.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp index d3a5185b..48242a5d 100644 --- a/update_verifier/update_verifier.cpp +++ b/update_verifier/update_verifier.cpp @@ -239,23 +239,36 @@ int update_verifier(int argc, char** argv) { // The current slot has not booted successfully. #if defined(PRODUCT_SUPPORTS_VERITY) || defined(BOARD_AVB_ENABLE) + bool skip_verification = false; std::string verity_mode = android::base::GetProperty("ro.boot.veritymode", ""); if (verity_mode.empty()) { + // With AVB it's possible to disable verification entirely and + // in this case ro.boot.veritymode is empty. +#if defined(BOARD_AVB_ENABLE) + LOG(WARNING) << "verification has been disabled; marking without verification."; + skip_verification = true; +#else LOG(ERROR) << "Failed to get dm-verity mode."; return reboot_device(); +#endif } else if (android::base::EqualsIgnoreCase(verity_mode, "eio")) { // We shouldn't see verity in EIO mode if the current slot hasn't booted successfully before. // Continue the verification until we fail to read some blocks. LOG(WARNING) << "Found dm-verity in EIO mode."; + } else if (android::base::EqualsIgnoreCase(verity_mode, "disabled")) { + LOG(WARNING) << "dm-verity in disabled mode; marking without verification."; + skip_verification = true; } else if (verity_mode != "enforcing") { LOG(ERROR) << "Unexpected dm-verity mode : " << verity_mode << ", expecting enforcing."; return reboot_device(); } - static constexpr auto CARE_MAP_FILE = "/data/ota_package/care_map.txt"; - if (!verify_image(CARE_MAP_FILE)) { - LOG(ERROR) << "Failed to verify all blocks in care map file."; - return reboot_device(); + if (!skip_verification) { + static constexpr auto CARE_MAP_FILE = "/data/ota_package/care_map.txt"; + if (!verify_image(CARE_MAP_FILE)) { + LOG(ERROR) << "Failed to verify all blocks in care map file."; + return reboot_device(); + } } #else LOG(WARNING) << "dm-verity not enabled; marking without verification."; |