History log of /system/update_engine/scripts/update_payload/checker.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
92161a7b83c3a491871a167a4d46e4e6b6101e81 29-Jun-2016 Sen Jiang <senj@google.com> paycheck: Support minor version 4.

From https://chromium-review.googlesource.com/#/c/333160/

Bug: 27156473
Test: ./scripts/update_payload/checker_unittest.py

Change-Id: I940debd5c878f622970e214fce75588f96d78407
/system/update_engine/scripts/update_payload/checker.py
d6122bb9df5b593a3ab1fc35fab7f1a0caa53928 11-Dec-2015 Sen Jiang <senj@chromium.org> paycheck: Allow minor version 3 in applier.

Also fixed nits in checker.

BUG=chromium:568473
TEST=./checker_unittest.py

Change-Id: Ia791f4dc636e9c3a2921aeaa5f9dd01c247bf5bb
Reviewed-on: https://chromium-review.googlesource.com/317780
Trybot-Ready: Sen Jiang <senj@chromium.org>
Tested-by: Sen Jiang <senj@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Sen Jiang <senj@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
912c4df6c4f470ddb6937b40cbe281229548783d 10-Dec-2015 Sen Jiang <senj@chromium.org> paycheck: support minor version 3.

Added check for mandatory source operation hash in minor version 3.

Fixed unittest.

BUG=chromium:568473
TEST=./paycheck.py <minor v3 payload>; ./checker_unittest.py

Change-Id: Id96ddce8c59f28b3449524b786c54a6c69ca798f
Reviewed-on: https://chromium-review.googlesource.com/317573
Trybot-Ready: Sen Jiang <senj@chromium.org>
Tested-by: Sen Jiang <senj@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
06eea33088be4418264d12820f94c700977e3fa6 14-Jul-2015 Gilad Arnold <garnold@chromium.org> paycheck: Properly infer usable target partition size.

The payload checker used to restrict read/write block indexes to the
reported target filesystem size, unless explicitly given a partition
size value to use instead. So far this value was easy for clients (like
paygen) to come up with, because it was constant at 2GB for all known
boards. However this is no longer the case, and there is no an easy way
for clients to know the actual target partition size after the payload
has been generated (nor is it encoded in the payload). This adds logic
for inferring the usable target partition size into PayloadChecker()
itself, as follows:

1) If a partition size was given, use that.

2) Else, if this is an old delta (minor version < 2), use the
aforementioned default. This is necessary because older deltas may
actually read/write data beyond the filesystem size. It is also
sufficient because any old delta payload we generate should write to
a 2GB target partition.

3) In all other cases, just use the new filesystem size, as encoded in
the payload. This is a safe choice for full updates and newer deltas.

The command-line tool is updated accordingly. Note that the usable
kernel partition size inference remains unaffected.

BUG=chromium:508566
TEST=Unit tests (revised)

Change-Id: I987f28fdfe1d82d0f6f565ae9852b7b11bce13e8
Reviewed-on: https://chromium-review.googlesource.com/285447
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
0d575cde18a1b44e386181dc1abbc611b9ae7a59 14-Jul-2015 Gilad Arnold <garnold@chromium.org> paycheck: Improve minor_version checking.

1) We explicitly catch whether this field is not set. This means we
might fail payloads generated by an old delta_generator, but ensures
that we catch such a failure in current payload generation. Test
logic slightly restructured to reduce duplication.

2) Slight changes to the checker method signature, for better uniformity
with the rest of the code. This also lets us test that we actually
read the minor_version field.

BUG=chromium:508566
TEST=Unit tests (revised)

Change-Id: Ib2d1999964ba892ef778ffc16bd1ca1c7d02bcd5
Reviewed-on: https://chromium-review.googlesource.com/285446
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
b065e13f600d0efc7f089a382611ffd93a8afce9 24-Apr-2015 Allie Wood <alliewood@chromium.org> paycheck: Check MOVE operations for start block 0.

paycheck now blocks payloads that read or write to block 0 in a MOVE
operation. It must do this because old versions of PReadAll and
PWriteAll could not seek to 0.

BUG=chromium:480751
TEST=unit tests, test_paycheck.sh

Change-Id: I042de444c92896496795af235e9386dca6c77be2
Reviewed-on: https://chromium-review.googlesource.com/267088
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
7cf9f13f2715d0a033c6300a244b40302d8eb7b7 26-Feb-2015 Allie Wood <alliewood@chromium.org> update_payload: Move minor version checks to CheckOperation.

Various small fixes. Move checks for operation and minor version
compatibility to CheckOperation.

BUG=none
TEST=`./checker_unittest.py` and running paycheck on payloads.

Change-Id: I6abd0ec200c1d4d885b09dfb84ee7e6cfad4172c
Reviewed-on: https://chromium-review.googlesource.com/254345
Reviewed-by: Allie Wood <alliewood@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
f5c4f3e2a6e7c93e5b4c09272091f23a935fab86 21-Feb-2015 Allie Wood <alliewood@chromium.org> update_payload: Add checks for new operations and minor version.

Paycheck now checks to make sure delta payloads with minor version 1 do
not have SOURCE_COPY or SOURCE_BSDIFF operations and that payloads with
minor version 2 do not have MOVE or BSDIFF operations. It also checks that
the minor version given matches the payload type (delta or full).

BUG=chromium:459799
TEST=`./checker_unittest.py` and running paycheck on payloads.

Change-Id: I2a61e44760ae2b672015acdf8683501327b5d197
Reviewed-on: https://chromium-review.googlesource.com/253050
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
5bc7fbea01f944192f146b97cd83050858cddcc5 05-Feb-2015 Gilad Arnold <garnold@chromium.org> paycheck: Allow payloads with no operations.

Due to a fix to the delta generator (CL:246670) we may actually end up
with delta payloads that contain no operations (e.g. a delta from an
image to itself). This is a good thing and we want paycheck to not rule
out trivial deltas such as these.

BUG=chromium:453659
TEST=Empty delta verification passes

Change-Id: I461f48bba743a5b96b77aa3f55697ffc5cb8ea0e
Reviewed-on: https://chromium-review.googlesource.com/246673
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
f583a7d7c5255ec0e2321db60b7690c25e58c290 05-Feb-2015 Gilad Arnold <garnold@chromium.org> paycheck: Fix format compliance errors.

BUG=None
TEST=None

Change-Id: I2d810bae961387a63495ba5bbe85b7222b5f86ef
Reviewed-on: https://chromium-review.googlesource.com/246672
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
6a3a3878daddc2536a2ac9033189274cfc5ef52d 05-Oct-2013 Gilad Arnold <garnold@chromium.org> paycheck: fix errors around percentage / formatting of zero sizes

This fixes two problems, both having to do with histogram generation:

* When the total number of elements is zero, paycheck would crash due to
a division by zero; further, even if the crash is fixed (returning,
say, None) the histogram will contain a meaningless value in
parenthesis, which we might as well drop. Both are fixed here.

* When some size (say, bytes) is zero, its formatter
(bytes-to-human-readable) returns None, which shows up as is in the
final report. This should be checked and avoided.

BUG=None
TEST=Crash fixed; None percentage/formatted value omitted.

Change-Id: I8bb5fbc47e1cde9dcbee7f7b96bcb63ef3a0935e
Reviewed-on: https://chromium-review.googlesource.com/172046
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
cb638915dbc2e0898b0562c98019c077d7fc1e8a 24-Jun-2013 Gilad Arnold <garnold@chromium.org> paycheck: fixes to checker module (readability review)

BUG=None
TEST=Passes unit tests
TEST=Passes integration tests

Change-Id: Ifd502af9d2755b2c23805cd03857ebbf0e633732
Reviewed-on: https://chromium-review.googlesource.com/59752
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
9753f3d28bda5d2abd7d17eb79022f7e02cb65b9 23-Jul-2013 Gilad Arnold <garnold@chromium.org> paycheck: accommodate > 255 block reads/writes

It turns out that, in some delta payloads, we're read/writing specific
blocks as many as 270 times. Therefore, the unsigned char counters we've
used for recording these accesses overflow and cause the execution to
die unexpectedly (also failing paygen when that happens). This change
increases the counter size to an unsigned short.

It should be noted that the fact that we have such frequently accessed
blocks through the course of an update is somewhat troubling by itself,
and should be investigated.

BUG=chromium:261417
TEST=Checking a previously failed payload now passes

Change-Id: I47903cde9971c142cd33382b485b22a88a06b80f
Reviewed-on: https://gerrit.chromium.org/gerrit/63040
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
0990f51671e3e392a3e19027b9a4ac4f69f36ba1 31-May-2013 Gilad Arnold <garnold@chromium.org> update_payload library: TODO + bug references

BUG=chromium:243559
TEST=None

Change-Id: I6837b87ff6f0b845ebbca97fdfa4190dc2d1282a
Reviewed-on: https://gerrit.chromium.org/gerrit/57179
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
9b90c93edcaa16f6c734f421ccf00201a474d9ea 23-May-2013 Gilad Arnold <garnold@chromium.org> paycheck: move default pubkey handling inside the library

This is a more sensible choice given that the pubkey ships within the
library directory and hence should not be specified explicitly by an
outside entity (like paycheck). From the practical standpoint, it makes
this useful feature available to clients who use the library directly.

BUG=chromium:241283
TEST=Unit + integration tests

Change-Id: I059302326af1e0e394829466ee97ad2f60de4986
Reviewed-on: https://gerrit.chromium.org/gerrit/56335
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
4f50b413c60a5ef8d642b9d7493baa92c8eedd09 14-May-2013 Gilad Arnold <garnold@chromium.org> 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>
/system/update_engine/scripts/update_payload/checker.py
272a499e2db9d72a64490ca5ccbebe8155fc2966 08-May-2013 Gilad Arnold <garnold@chromium.org> paycheck: support for in-place BSDIFF operations

When applying BSDIFF operations in payloads, we used to extract the
block sequences from the old partition and serialize it into a temporary
file, and vice versa for the new partition. This worked but did not
allow us to test bspatch as it is actually being used by the update
engine.

This CLs allows paycheck to invoke bspatch so that it reads/writes block
extents directly from/to the partition file, in the same way it's being
used by the update engine. Since performance is the same, this is the
new default behavior; users can opt for the aforementioned old behavior
using a command-line flag (-x or --extract-bsdiff).

BUG=chromium:229705
TEST=bspatch invoked differently depending on the -x flag
TEST=Passes unit/integration tests

Change-Id: I8821754e1163b357617ece6befa42d1c2e575930
Reviewed-on: https://gerrit.chromium.org/gerrit/50486
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
9640537ac1b6abfae866424a11e6869228fb7cac 04-May-2013 Gilad Arnold <garnold@chromium.org> paycheck: use base64 encoding for SHA256 hashes throughout

Turns out we were using base64 when adding SHA256 data to a payload
report, but intermittently using hex encoding in error messages. This is
now fixed.

BUG=None
TEST=No mention of hex encoding in the code
TEST=gpylinted correctly
TEST=Passes unit tests

Change-Id: Id2dc2fcd154d4647cc1a076579dde7a789c09e40
Reviewed-on: https://gerrit.chromium.org/gerrit/50104
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
382df5ce2f4b67bf0998b01c6fedcdb5c35ebef9 03-May-2013 Gilad Arnold <garnold@chromium.org> paycheck: enforce physical partition size correctly

During payload checking, payload has wrongly interpreted the size
reported in the update payload to be the physical partition size,
whereas this is in fact the size of the filesystem portion only (a
misnomer). This sometimes caused it to emit errors on out-of-bounds
operations, which are otherwise harmless in real-world scenarios.

This CL makes a clear distinction between the two, with the following
semantics:

- The payload's embedded filesystem size must by <= the physical
partition sizes.

- Reading/writing from/to the new partition must be within the physical
partition size boundaries, and not the filesystem ones.

- Reading from the old partition is only allowed from filesystem
boundaries; this is unchanged from current behavior and appears to be
consistent with how we perform delta updates.

- Old/new SHA256 verification during payload application is now limited
to the allotted filesystem portion only (and not the full partition
size). This is consistent with the update engine's semantics.

- Other than that, this change currently has no further effect on
payload application, which remains more permissive wrt to partition
sizes. This also means that the sizes of partitions resulting from
a payload application will not necessarily abide by the predetermined
physical partition sizes. This is in line with the prevailing
division of responsibilities between payload checking (strict) and
application (relaxed).

BUG=chromium:221847
TEST=Payload checking respects partition size override
TEST=Unit tests pass
TEST=Integration tests pass

Change-Id: I0dbc88d538c0cc53b7551f4dfa8f543bcf480cd5
Reviewed-on: https://gerrit.chromium.org/gerrit/50103
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
eaed0d1371d781d3f5effa1475f5202dea9467e7 01-May-2013 Gilad Arnold <garnold@chromium.org> paycheck: allow to disable specific checks

This became necessary as the delta generator appears to generate
payloads that fail certain checks (e.g. during update_engine unit
testing).

BUG=None
TEST=Disabled checks not being triggered

Change-Id: I4491e0cb32ef44f85e11ffb0402b40d1371525ae
Reviewed-on: https://gerrit.chromium.org/gerrit/49676
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
5502b56f34f9703cf053be46e4ea5685c0c9ac26 08-Mar-2013 Gilad Arnold <garnold@chromium.org> paycheck: unit tests + fixes to checker module

This adds missing unit tests for the checker module, bundled with fixes
to some bugs that surfaced due to unit tests. This includes:

* A fake extent (signified by start_block == UINT64_MAX) that
accompanies a signature data blob bears different requirements than
previously implemented. Specifically, the extent sequence must have
exactly one extent; and the number of blocks is not necessarily one,
rather it is the correct number that corresponds to the actual length
of the signature blob.

* REPLACE/REPLACE_BZ operations must contain data.

* MOVE operation validation must ensure that all of the actual message
extents are being used.

* BSDIFF operation must contain data (the diff).

* Signature pseudo-operation should be a REPLACE.

BUG=chromium-os:34911,chromium-os:33607,chromium-os:7597
TEST=Passes unittests (upcoming); works with actual payloads.

Change-Id: I4d839d1d4da1fbb4a493b208958a139368e2c8ca
Reviewed-on: https://gerrit.chromium.org/gerrit/45429
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
aa55d1a133cced2e084e69d5b1dd4d17c0e0d054 08-Mar-2013 Gilad Arnold <garnold@chromium.org> Fix update out-of-bounds check for partition boundary.

This is an off-by-one error caught during the implementation of unit
tests.

BUG=None
TEST=Unit tests (upcoming) pass as expected.

Change-Id: I9a5da10588f0ac4314e9a35280ff1f38c34c88ac
Reviewed-on: https://gerrit.chromium.org/gerrit/44953
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
/system/update_engine/scripts/update_payload/checker.py
553b0ec49bc64fc4b7df4358cd31396a87276d2b 26-Jan-2013 Gilad Arnold <garnold@chromium.org> Update payload library + command-line tool

An initial implementation of a Python module for parsing, checking and
applying a Chrome OS update payload. Comes with a command-line tool
(paycheck.py) for applying such operations on payload files, and a test
script (test_paycheck.sh) for ensuring that the library and tool are
working correctly.

Since update_payload is introduced as a package, we're moving some
previously merged utilities into the package's directory.

(Unit testing for this code will be uploaded on a separate CL; see
chromium-os:39663)

BUG=chromium-os:34911,chromium-os:33607,chromium-os:7597
TEST=test_paycheck.sh successful on MP-signed payloads
CQ-DEPEND=I5746a1d80e822a575f0d96f94d0b4e765fc64507

Change-Id: I77123a1fffbb2059c239b7145c6922968fdffb6a
Reviewed-on: https://gerrit.chromium.org/gerrit/43041
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/scripts/update_payload/checker.py