Skip to content

[RFC] sim: validate VIP digest tables and chunk hashes in dry-run mode#205

Merged
andersson merged 2 commits intolinux-msm:masterfrom
igoropaniuk:feat/validate_vip_tables_dry_run
Apr 6, 2026
Merged

[RFC] sim: validate VIP digest tables and chunk hashes in dry-run mode#205
andersson merged 2 commits intolinux-msm:masterfrom
igoropaniuk:feat/validate_vip_tables_dry_run

Conversation

@igoropaniuk
Copy link
Copy Markdown
Contributor

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.

Comment thread sim.c
@igoropaniuk igoropaniuk force-pushed the feat/validate_vip_tables_dry_run branch from 1b38a54 to ad0601c Compare March 30, 2026 18:33
Comment thread sim.c Outdated
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>
@igoropaniuk igoropaniuk requested a review from andersson April 3, 2026 19:30
@igoropaniuk igoropaniuk force-pushed the feat/validate_vip_tables_dry_run branch from ad0601c to 65b7ef5 Compare April 3, 2026 19:31
@andersson andersson merged commit 1cdefb3 into linux-msm:master Apr 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants