summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2017-10-11 09:51:58 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-12-16 01:12:53 +0000
commitac1e34be459c8b34b85bb2a36a7d9507dd0f8d06 (patch)
treead7dc476fb347bd0b7879514cd45b1fee758b7d8
parent8b9d5a1fdf8bba38209bbd1996de8ca09f6616e0 (diff)
downloadchrome-ec-ac1e34be459c8b34b85bb2a36a7d9507dd0f8d06.tar.gz
chip/g: Run unrestricted image even if Board ID can't be read
Previously, an error reading Board ID would prevent any image from running, even a wildcard (unrestricted) image with mask=flags=0 which would match any Board ID. Now, if Board ID can't be read, match the image against type=type_inv=flags=0. This will match only an unrestricted image. (This is better than checking directly for an unrestricted image, because that check is more susceptible to clock-jitter-induced errors.) BUG=b:67651806 BRANCH=cr50 TEST=Hack read_board_id() to return error. See that an unrestricted image will now boot. Change-Id: I1071e146b4541e8efd50c8409b8f76012a107731 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/713574 Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 7d9bd07693ba691404831861bc219e5ec7b57b82) Reviewed-on: https://chromium-review.googlesource.com/734788 Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit c1633c7153623351f0167422c79c9688abe7e27a) Reviewed-on: https://chromium-review.googlesource.com/828673
-rw-r--r--chip/g/board_id.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/chip/g/board_id.c b/chip/g/board_id.c
index ac47d973be..569540eb62 100644
--- a/chip/g/board_id.c
+++ b/chip/g/board_id.c
@@ -103,8 +103,17 @@ uint32_t board_id_mismatch(const struct SignedHeader *sh)
sh = get_current_image_header();
/* Get Board ID from INFO1. */
- if (read_board_id(&id) != EC_SUCCESS)
- return 1;
+ if (read_board_id(&id) != EC_SUCCESS) {
+ /*
+ * On failure, set id fields to 0. This will only match an
+ * unrestricted image header (board_id_mask=board_id_flags=0),
+ * which would run on any Board ID.
+ *
+ * Don't return error, because that would prevent all images
+ * from running.
+ */
+ id.type = id.type_inv = id.flags = 0;
+ }
return check_board_id_vs_header(&id, sh);
}