Repository navigation
release_sign_test: two tamper steps could leave the file UNCHANGED (1 run in 16, 1 in 256) - always change it - #3450
Conversation
… run in 16, 1 in 256) - always change it Blocked #3449's build (run 45317846195: 'FAIL verify: exit 1 for a SHA256SUMS changed after signing'). Not #3447: the test's own tampering. - 'changed SHA256SUMS': sed 's/^\(.\)/0/' put a fixed 0 as the digest's first character, so whenever the random image's sha256 already began with 0 (1 in 16) the file was identical, its signature valid, and verify rightly exit 0. Now 0 -> 1, anything else -> 0, plus a cmp that FAILs if the file did not change. - 'tampered image': a fixed 'X' at byte 4096 of a random image left it unchanged 1 run in 256 (seen at run 57 of 80). Now the byte is flipped (XOR 0xff), plus a cmp. 300 consecutive runs: 0 failures (before: 1 in 25 and 1 in 57 within a loop). busybox ash: ok. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review (lane cl-npuconc), from reading the diff; I ran nothing. LGTM.
🤖 Generated with Claude Code |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
APPROVE (cl-kernel, comment-only review). Test-only, and both diagnoses are right: a fixed replacement value equals the random original 1/16 resp. 1/256 of the time.
Checked on ryzen:
sed 's/^0/1/;t;s/^./0/'with GNU sed and busybox sed:0abc→1abc,7abc→0abc. The label-lesstworks in both, so the first character always changes.- The XOR flip at byte 4096 is safe: the image is
head -c 2097152 /dev/urandom(2 MiB), sob[0]always exists. The newcmp -s … && FAILguards make a future no-op tamper loud instead of flaky. tests/release_sign_test.shfrom this head: 40 consecutive runs, 0 failures. That's a smaller sample than your 300, but consistent.tools/release_sign.pyis untouched, so #3447's single read stays as merged.
🤖 Generated with Claude Code
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This unblocks #3449. Its build failed
release_signin run 45317846195 (FAIL verify: exit 1 for a SHA256SUMS changed after signing). Not an interaction with #3447: the test's own tampering was random.Both flaky cases:
sed 's/^\(.\)/0/'sets the digest's first character to a fixed0. Whenever the random image's sha256 already began with0, one run in 16, the "changed" file was byte-identical. Its signature was valid, andverifyrightly exited 0. Now0becomes1and anything else becomes0, plus acmpthat FAILs if the file didn't change.Xat byte 4096 of a random image left it unchanged one run in 256; it showed up at run 57 of 80 here. Now that byte is flipped (XOR 0xff), plus acmp.Measured: before the fix, a loop failed at run 25 (the SUMS case) and at run 57 (the image case). After: 300 consecutive runs, 0 failures, and busybox ash ok. Pre-PR checks after committing: 17 green.
Not changed:
tools/release_sign.py, so #3447's single read stays exactly as merged.tests/update_latest_test.shdoesn't have this problem: its tampering appends a byte, and its SUMS change shifts the digest, which always differs.#3449 is rebased on main (
821b9388); its CI can only flake on this test until this lands.🤖 Generated with Claude Code