Repository navigation
fix(satellite): record only hex generations - #225
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 28 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Andrei Kvapil (@kvaps) NOT LGTM: damaged hex values of the wrong length still reach metadata re-creation.
DRBD prints these UUIDs as 16 hex digits. IsGenerationUUID also accepts ABCD and the 17-digit 16E3A5D0B2C1F4A96, so the new read guard trusts values the tools do not print.
Evidence: I wrote each value as volume 0's only history entry and ran both metadata paths with an unclean probe and a valid dump after apply-al. Both returned success and ran create-md --force because the bad entry matched none of the real UUIDs. Adding len(s) == 16 makes the fail-closed reproducer pass.
Please reject short and overlong values on read and write, and cover them in the recording and repair tests.
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Andrei Kvapil (@kvaps) NOT LGTM: damaged hex values of the wrong length still reach metadata re-creation.
DRBD prints these UUIDs as 16 hex digits. IsGenerationUUID also accepts ABCD and the 17-digit 16E3A5D0B2C1F4A96, so the new read guard trusts values the tools do not print.
Evidence: I wrote each value as volume 0's only history entry and ran both metadata paths with an unclean probe and a valid dump after apply-al. Both returned success and ran create-md --force because the bad entry matched none of the real UUIDs. Adding len(s) == 16 makes the fail-closed reproducer pass.
Please reject short and overlong values on read and write, and cover them in the recording and repair tests.
The generation record took any non-empty string the observer handed it, and read back any non-empty token as a generation. A value that is not a GI would sit in the record as one, and a zero GI identifies nothing. Record only a non-zero hex UUID, and treat any other value in the file as a damaged line, which the readers already refuse. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
drbdsetup and drbdmeta print a generation UUID zero-padded to 16 hex digits. Any hex of another length was accepted on both sides, so a damaged history line matched none of the real UUIDs and the repair went on to create-md. A value of another length is now damage, in the record and in the metadata dump alike. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
4c6324e to
65ad6e0
Compare
|
Fixed in 65ad6e0, a generation has to be exactly 16 hex digits now on read and write, and the dump parser uses the same check. Short and long values are in the recording test and in the repair test on both paths. |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Andrei Kvapil (@kvaps) NOT LGTM: the tests do not catch a missing hex check.
Every non-hex fixture is also the wrong length. Evidence: I removed only isHex(s) from IsGenerationUUID, and the full suites for the three affected packages still passed. On that mutant, a separate test with the 16-character 6E3A5D0B2C1F4A9G ran create-md --force on both metadata paths. The current implementation rejects it correctly.
Please add a 16-character non-hex value to the recording and damaged-history cases so the hex check is tested independently of the length check.
Every non-hex value the tests used was also the wrong length, so the hex check could go without any test noticing. A 16-character value with a non-hex digit is now refused on recording, on reading the history back, and in a metadata dump. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Added |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Andrei Kvapil (@kvaps) LGTM. I repeated the hex-only mutation with the committed tests and it fails on recording, damaged history on both metadata paths, and metadata dumps. The width and zero mutations fail too.
Follow-up to #220.
The GI record took any non-empty string from the observer and read back any non-empty token as a generation. Now only a non-zero hex UUID, the way
drbdsetupanddrbdmetaprint it without0x, gets recorded. A zero GI is skipped quietly, since it is DRBD's "none yet". Anything else is skipped with a warning.On read, a line whose generation is not such a UUID counts as damaged, so the repair refuses the record instead of trusting it, same as for the other damaged lines.
Tests:
TestOnlyHexGenerationsAreRecorded, plus two more cases inTestUnreadableGIRecordFailsClosed.Summary by CodeRabbit