Set up update_verifier logging to be written to kmsg; because we may
not have Logd during boot time.
Bug: 64713327
Test: logs show up in `adb shell dmesg`
Change-Id: If02f460bda121cd3e9062bc0e08107c6da66492c
This CL is to change update_verifier to verify blocks in parallel to
maximize storage bandwidth, it also preallocate the buffer to avoid
vector allocation within reading loop.
Test:
care_map.txt:
system
16,0,517,556,32770,33084,98306,98620,163842,164156,229378,229692,294914,295228,483544,524288,524296
vendor
8,0,119,135,32770,32831,96150,98304,98306
With CL:
init: Service 'update_verifier_nonencrypted' (pid 711) exited with status 0 waiting took 2.978424 seconds
Without CL:
init: Service 'update_verifier_nonencrypted' (pid 695) exited with status 0 waiting took 4.466320 seconds
Bug: 63686531
Test: reboot with manual insert care_map.txt
Change-Id: Idf791865f15f6ff6cad89bf7ff230ee46c6adccc
(cherry picked from commit bd9664b5a0)
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.
Bug: 64315394
Change-Id: I8310849e347248f4a96158838310f688ecef4211
update_verifier should be backward compatible to not reject legacy
care_map.txt from old releases, which could otherwise fail to boot into
the new release.
For example, we've changed the care_map format between N and O. An O
update_verifier would fail to work with an N care_map.txt - a) we have
switched update_verifier to read from device mapper in O; b) the last
few blocks that contain metadata can't be read via device mapper. This
could be a result of sideloading an O OTA while the device having a
pending N update.
Bug: 63544345
Test: As follows on sailfish:
1. Flash the device with this CL;
2. Put a copy of N care_map.txt at /data/ota_package/. Restore the
permissions properly ('cache' group);
3. `adb reboot bootloader`;
4. `fastboot set_active <current_slot>`
5. Device boots up into home screen, with a warning in logcat that says
it has skipped legacy care_map.txt.
Change-Id: I6acc88c9e655a9245e6531f176fef7953953935f
When using AVB, PRODUCT_SUPPORTS_VERITY is not set so check for
BOARD_ENABLE_AVB as well. Also AVB sets up the root filesystem as
'vroot' so map that to 'system' since this is what is
expected. Managed to test at least that the code is at least compiled
in:
$ fastboot --set-active=_a
Setting current slot to 'a'...
OKAY [ 0.023s]
finished. total time: 0.023s
$ fastboot reboot
rebooting...
finished. total time: 0.050s
$ adb wait-for-device
$ adb logcat |grep update_verifier
03-04 05:28:56.773 630 630 I /system/bin/update_verifier: Started with arg 1: nonencrypted
03-04 05:28:56.776 630 630 I /system/bin/update_verifier: Booting slot 0: isSlotMarkedSuccessful=0
03-04 05:28:56.776 630 630 W /system/bin/update_verifier: Failed to open /data/ota_package/care_map.txt: No such file or directory
03-04 05:28:56.788 630 630 I /system/bin/update_verifier: Marked slot 0 as booted successfully.
03-04 05:28:56.788 630 630 I /system/bin/update_verifier: Leaving update_verifier.
Bug: None
Test: Manually tested on device using AVB bootloader.
Change-Id: I13c0fe1cc5d0f397e36f5e62fcc05c8dfee5fd85
Limit the size of each read to 1024 * BLOCKSIZE. (Same as the I/O limit
of each transfer command for block based OTA).
Bug: 37729708
Test: U_V sets slot successfully on sailfish, and it takes about ~20s
(no noticeable time increase)
Change-Id: I7a6cdc744fe4c0760e09e0afed75b89c16d8eac3
update_verifier should be in the cache group, not 'class'.
Also use PLOG instead of LOG if care_map.txt cannot be opened.
Bug: 36818743
Test: boot sailfish
Test: fake OTA on sailfish and verify update_verifier reads care_package
Change-Id: I0ec844cac5ef5c63b18ebee90160854fd84ee829
Highest ioprio is 0 for CFQ and we should run update_verifier with that.
Tested on device and showing boottime decreased.
Bug: 36511808
Bug: 36102163
Test: Boot marlin
Change-Id: Iddd925951d976e21014b61e5590bcdae3cea8470
Update_verifier will reboot the device if it fails to read some blocks
on the care_map when veritymode=eio. Also make some partition name
changes to match the care_map.txt.
Test: Update_verifier reboots the device after read failures in eio mode.
Change-Id: Icf68e6151dee72f626a9ab72946100cf482a4e6c
Raise the priority and ioprio of update_verifier and launch with
exec_start. This saves ~100ms of time before `class_start main` is executed.
Bug: 36511808
Bug: 36102163
Test: Boot bullhead
Test: Verify boottime decrease on sailfish
Change-Id: I944a6c0d4368ead5b99171f49142da2523ed1bdd
For devices that are not using dm-verity, update_verifier can't verify
anything, but to mark the successfully booted flag unconditionally.
Test: Successfully-booted flag is set on devices w/o dm-verity.
Test: Successfully-booted flag is set after verification on devices w/
dm-verity.
Change-Id: I79ab2caec2d4284aad0d66dd161adabebde175b6
update_verifier used to read from system_block_device, which bypasses
dm-verity check completely. Switch update_verifier to read the corresponding
'/dev/block/dm-X' instead. U_v gets the verity block device number by
comparing the contents in '/sys/block/dm-X/dm/name'.
Bug: 34391662
Test: update_verifier detects the corrupped blocks and dm-verity trigger the reboot on Sailfish.
Change-Id: Ie5c50c23410bd29fcc6e733ba29cf892e9a07460
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds; verify HAL still works
In support of b/33844934
Change-Id: I5ce988128b0471384e1472298a0ae383df2b7c3e
Merged-In: I86c44aaaaf663e774c631a469ebf2b81619f89c4
Also make minor changes to android::base::ParseUint(), which accepts
std::string now.
Test: Flash an A/B device and make sure update_verifier works (by
marking the active slot as successfully booted).
Change-Id: Id6e578671cb3c87160c2b6ca717ee618ecf2342a
Test: UV logs show success in both binderized and passthrough modes.
Bug: 31864052
Change-Id: Ied67a52c458dba7fe600e0fe7eca84db1a9f2587
Signed-off-by: Connor O'Brien <connoro@google.com>
Read all blocks in system and vendor partition during boot time
so that dm-verity could verify this partition is properly flashed.
Bug: 27175949
Change-Id: I38ff7b18ee4f2733e639b89633d36f5ed551c989
Test: mma
(cherry picked from commit 03ca853a1c)
(cherry picked from commit 4bbe0c93c8)
(Fix a typo when comparing the verity mode)
(cherry picked from commit da654af606)
(Skip update verification if care_map is not found)
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.
Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
Clean up the recovery image and switch to libbase logging.
Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
[1] added a new API isSlotMarkedSuccessful() to actually query if a
given slot has been marked as successful.
[1]: commit 72c88c915d957bf2eba73950e7f0407b220d1ef4
Change-Id: I9155c9b9233882a295a9a6e607a844d9125e4c56
logd already gets started before we call update_verifier.
Bug: 26039641
Change-Id: If00669a77bf9a6e5534e33f4e50b42eabba2667a
(cherry picked from commit 45eac58ef1)
update_verifier checks the integrity of the updated system and vendor
partitions on the first boot post an A/B OTA update. It marks the
current slot as having booted successfully if it passes the verification.
This CL doesn't perform any actual verification work which will be
addressed in follow-up CLs.
Bug: 26039641
Change-Id: Ia5504ed25b799b48b5886c2fc68073a360127f42
(cherry picked from commit 1171d3a12b)