[RFC] sim: validate VIP digest tables and chunk hashes in dry-run mode#205
Merged
andersson merged 2 commits intolinux-msm:masterfrom Apr 6, 2026
Merged
Conversation
igoropaniuk
commented
Mar 30, 2026
1b38a54 to
ad0601c
Compare
andersson
reviewed
Mar 30, 2026
Without any verification on the host side, a dry-run with pre-built VIP tables (-n -D <path>) would silently succeed even when the digest tables did not match the data being flashed. The only way to catch a mismatch was to attempt a real flash and wait for the device to reject it, which wastes time and risks leaving a device in a broken state. Add hash validation to the simulator so mismatches are caught at dry-run time, before any hardware is involved. The signed initial table (DigestsToSign.bin.mbn) and all chained tables (ChainedTableOfDigests<n>.bin) are parsed as they arrive. Chain hashes linking each table to the next are verified to ensure table integrity. Per-chunk SHA256 hashes are checked in order against every XML command write and raw payload write; any mismatch is reported via ux_err() without aborting so all mismatches remain visible at the end of a run. Validation is active in exactly the intended modes: -n plain dry-run, no tables sent -- no-op -n -D <path> dry-run with VIP tables -- full hash validation -n -t <dir> digest generation -- validation disabled MAX_DIGESTS_PER_SIGNED_FILE and MAX_DIGESTS_PER_CHAINED_FILE are moved from vip.c to vip.h so sim.c can reference them. sha2.c is added to RAMDUMP_SRCS because qdl-ramdump links sim.o which now calls SHA256. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Add a subsection under the VIP section that explains the workflow, what QDL verifies, and why running a dry-run validation before touching hardware saves time and avoids leaving devices in a broken state. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
ad0601c to
65b7ef5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without any verification on the host side, a dry-run with pre-built VIP
tables (
-n -D <path>) would silently succeed even when the digest tablesdid not match the data being flashed. The only way to catch a mismatch
was to attempt a real flash and wait for the device to reject it, which
wastes time and risks leaving a device in a broken state.
Add hash validation to the simulator so mismatches are caught at dry-run
time, before any hardware is involved.
The signed initial table (DigestsToSign.bin.mbn) and all chained tables
(
ChainedTableOfDigests<n>.bin) are parsed as they arrive. Chain hasheslinking each table to the next are verified to ensure table integrity.
Per-chunk SHA256 hashes are checked in order against every XML command
write and raw payload write; any mismatch is reported via
ux_err()without aborting so all mismatches remain visible at the end of a run.
Validation is active in exactly the intended modes:
MAX_DIGESTS_PER_SIGNED_FILEandMAX_DIGESTS_PER_CHAINED_FILEare movedfrom
vip.ctovip.hsosim.ccan reference them.sha2.cis added toRAMDUMP_SRCS because qdl-ramdump links sim.o which now calls SHA256.