mcuboot/boot
Christopher Collins ae01f153b1 Set pending: don't crash when image slot corrupt
This change affects the "set pending" operation.  That is, the operation
that configures mcuboot to temporarily swap images on the next boot.

PRIOR TO COMMIT:

If the slot 1 trailer contained an invalid 128-bit magic number, an
assertion would fail, causing a crash.

AFTER COMMIT:

If corruption is detected in the slot 1 trailer, the entire image slot
is erased, and the "set pending" operation fails with a `BOOT_EBADIMAGE`
status.

RATIONALE:

mcuboot cannot meaningfully recover from data corruption.  The only
recourse is to erase the bad data so that future upgrades can be
performed.  I was tempted to add a build-time setting to control whether
the image slot gets erased when corruption is detected, but I dont think this
freedom justifies the cost of extra config.  A device with a corrupt
image slot can no longer be upgraded, so the only reason someone would
want to preserve the corrupt data would be for debugging.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2019-01-31 18:13:52 -02:00
..
boot_serial Fix Mynewt builds; add log stub dependency 2019-01-12 14:38:41 -07:00
bootutil Set pending: don't crash when image slot corrupt 2019-01-31 18:13:52 -02:00
mynewt Fix Mynewt builds; add log stub dependency 2019-01-12 14:38:41 -07:00
zephyr zephyr:board: squash nrf51_pca10028 flash footprint 2019-01-30 14:45:38 +01:00