Skip to content

fix(daemon): classify a differing peer-image digest as a mismatch in every verify outcome - #2991

Open
DeusData wants to merge 1 commit into
mainfrom
fix/daemon-peer-image-mismatch-verdict
Open

DeusData wants to merge 1 commit into
mainfrom
fix/daemon-peer-image-mismatch-verdict

Conversation

@DeusData

Copy link
Copy Markdown
Owner

What

runtime_peer_image_verify now classifies a peer image whose computed digest differs from this build as RUNTIME_PEER_IMAGE_MISMATCH (rejected with fingerprint_mismatch), whatever the outcome of the post-hash consistency re-check. Images that cannot be hashed at all, or whose digest matches, are handled exactly as before (#1539).

Change

  • runtime_process_image_reference_acquire_observed (the former acquire body) also hands back the digest it computed. The existing acquire name stays as a thin wrapper, so every other caller is unchanged.
  • runtime_peer_image_verify compares that digest with this build and returns a mismatch when it differs.

Test

tests/test_daemon_runtime.c (daemon_runtime suite): daemon_runtime_peer_image_mismatch_stays_rejected_when_recheck_fails, three HELLOs:

  1. differing digest, re-check intact: rejected with fingerprint_mismatch (control)
  2. differing digest, re-check fails: rejected with fingerprint_mismatch
  3. matching digest, re-check fails: admitted (unchanged)

The in-process peer is the test process itself, so a new test-only seam, cbm_daemon_runtime_fail_image_recheck_after_hash_for_testing (compiled only with CBM_ENABLE_TEST_SEAMS), fails the re-check after the digest was computed; the existing distinct-copy seam forces the full hash and the existing hash stub supplies the digest. No timing decides any verdict.

Verification (macOS arm64, ASan/UBSan test-runner)

  • The new test fails without the verify change and passes with it.
  • daemon_runtime, daemon_frontend and daemon_bootstrap: 103 passed on the final tree (main 1ec2f26).
  • clang-format clean on the changed lines.

…every verify outcome

runtime_peer_image_verify now reports a peer image whose computed
digest differs from this build as RUNTIME_PEER_IMAGE_MISMATCH
regardless of the post-hash consistency re-check. Images that cannot
be hashed, or whose digest matches, are handled as before (#1539).
runtime_process_image_reference_acquire_observed (the former acquire
body) also hands back the digest it computed; the old acquire name
stays a wrapper, so every other caller is unchanged.

Test (daemon_runtime suite):
daemon_runtime_peer_image_mismatch_stays_rejected_when_recheck_fails,
three HELLOs: differing digest -> rejected (control); differing digest
with a failed re-check -> rejected; matching digest with a failed
re-check -> admitted (unchanged). A CBM_ENABLE_TEST_SEAMS-only seam,
cbm_daemon_runtime_fail_image_recheck_after_hash_for_testing, fails the
re-check after the digest was computed; the existing distinct-copy seam
and hash stub decide the digest.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant