Repository navigation
Fix a 1-in-256 flake in the salt-label selftest - #765
Merged
Merged
Conversation
The selftest reported the first 16-byte DEK window in the salt, so when random filler byte 14 equalled dek[14] (1 in 256) the label became 14..31 and the first assertion failed. Setting that byte to differ from dek[14] makes the 15..31 label deterministic. Details: TC-4444
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.
selftest_salt_piece_labels_do_not_depend_on_filler_bytesfailed about 1 run in 256. The selftest builds a salt whose random filler byte 14 can equal the DEK's byte 14. The salt scan reports the first 16-byte DEK window it finds, so in that case the window starting at byte 14 matches and the label becomes 14..31, not 15..31, which fails the firstensure!.The fix is one added line,
old_half_b[14] = !dek[14];, which forces filler byte 14 to differ from the DEK.This changes an existing test, by adding one line and changing no assertion. The 15..31 assertion and the 20,000-trial loop are untouched. The test-edit guard's advisory asks for this explanation.
Verification: 2000 runs of the test binary with the fix, 0 failures (about 0.5 s per run). Without the line, 2000 runs gave 8 failures.
cargo fmt --all -- --checkis clean.Details: TC-4444