summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxunchang <xunchang@google.com>2019-04-25 10:37:36 -0700
committerTianjie Xu <xunchang@google.com>2019-04-26 13:44:50 -0700
commitf6fd73661bebb7fec2a672da29379a7fe4e6c0eb (patch)
tree904b1a546cbcd8393a95dacfe394eb5adfcab087
parent23ba59e60ffe386e1f7a35883355aefa6fa9089d (diff)
Set the block device to be writable before writing verity data
The block device is set to be writable when the delta performer opens the partition to perfrom writes. But if the update interrupts and the device reboots during the verity data calculation, update engine will consider the write actions done on resumes and skip setting the writable flag. As a result, the resumed update will fail to write the hashtree with EPERM. A possible fix is to explicltly set the flag when the FilesystemVerifierAction wants to write verity data. Bug: 131232680 Test: Interrupt the update during verity writing, reboot and check the update resumes correctly Change-Id: I1007414139e4ae5be3fc60ec73b18264d4baa60e
-rw-r--r--payload_consumer/verity_writer_android.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/payload_consumer/verity_writer_android.cc b/payload_consumer/verity_writer_android.cc
index 06d1489b..d5437b64 100644
--- a/payload_consumer/verity_writer_android.cc
+++ b/payload_consumer/verity_writer_android.cc
@@ -41,6 +41,9 @@ std::unique_ptr<VerityWriterInterface> CreateVerityWriter() {
bool VerityWriterAndroid::Init(const InstallPlan::Partition& partition) {
partition_ = &partition;
+ if (partition_->hash_tree_size != 0 || partition_->fec_size != 0) {
+ utils::SetBlockDeviceReadOnly(partition_->target_path, false);
+ }
if (partition_->hash_tree_size != 0) {
auto hash_function =
HashTreeBuilder::HashFunction(partition_->hash_tree_algorithm);