paycheck: allow src_extents to span the whole new partition size
In a previous fix, we allowed paycheck to consider the whole new
partition (beyond just the filesystem) as valid range for write
operations. However, since updates are done in place, they should also
be considered valid for read operations. This is now fixed.
BUG=chromium:240726
TEST=Previously failing delta update now verified successfully
Change-Id: Ib904c0265e2fd61ab0768169b3257c4131441888
Reviewed-on: https://gerrit.chromium.org/gerrit/51138
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py
index 7631cb0..a9edce3 100644
--- a/scripts/update_payload/checker.py
+++ b/scripts/update_payload/checker.py
@@ -772,7 +772,7 @@
total_dst_blocks * self.block_size))
def _CheckOperation(self, op, op_name, is_last, old_block_counters,
- new_block_counters, old_fs_size, new_usable_size,
+ new_block_counters, old_usable_size, new_usable_size,
prev_data_offset, allow_signature, blob_hash_counts):
"""Checks a single update operation.
@@ -782,8 +782,8 @@
is_last: whether this is the last operation in the sequence
old_block_counters: arrays of block read counters
new_block_counters: arrays of block write counters
- old_fs_size: the old filesystem size in bytes
- new_usable_size: the overall usable size of the new partition in bytes
+ old_usable_size: the overall usable size for src data in bytes
+ new_usable_size: the overall usable size for dst data in bytes
prev_data_offset: offset of last used data bytes
allow_signature: whether this may be a signature operation
blob_hash_counts: counters for hashed/unhashed blobs
@@ -795,7 +795,7 @@
"""
# Check extents.
total_src_blocks = self._CheckExtents(
- op.src_extents, old_fs_size, old_block_counters,
+ op.src_extents, old_usable_size, old_block_counters,
op_name + '.src_extents', allow_pseudo=True)
allow_signature_in_extents = (allow_signature and is_last and
op.type == common.OpType.REPLACE)
@@ -897,7 +897,7 @@
base_name: the name of the operation block
old_fs_size: the old filesystem size in bytes
new_fs_size: the new filesystem size in bytes
- new_usable_size: the olverall usable size of the new partition in bytes
+ new_usable_size: the overall usable size of the new partition in bytes
prev_data_offset: offset of last used data bytes
allow_signature: whether this sequence may contain signature operations
Returns:
@@ -931,7 +931,7 @@
blob_hash_counts['signature'] = 0
# Allocate old and new block counters.
- old_block_counters = (self._AllocBlockCounters(old_fs_size)
+ old_block_counters = (self._AllocBlockCounters(new_usable_size)
if old_fs_size else None)
new_block_counters = self._AllocBlockCounters(new_usable_size)
@@ -948,8 +948,9 @@
is_last = op_num == len(operations)
curr_data_used = self._CheckOperation(
op, op_name, is_last, old_block_counters, new_block_counters,
- old_fs_size, new_usable_size, prev_data_offset + total_data_used,
- allow_signature, blob_hash_counts)
+ new_usable_size if old_fs_size else 0, new_usable_size,
+ prev_data_offset + total_data_used, allow_signature,
+ blob_hash_counts)
if curr_data_used:
op_blob_totals[op.type] += curr_data_used
total_data_used += curr_data_used