-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ReadDMVeritySuperBlock function #1257
Fix ReadDMVeritySuperBlock function #1257
Conversation
Make sure to assert the value of dmveritySuperblock.Signature before trying to read the root hash, without the check, any valid footer would be treated as a dm-verity superblock. Add unit tests to cover other edge cases. Signed-off-by: Maksim An <maksiman@microsoft.com>
In some places when returning an error from ReadDMVeritySuperBlock, a custom error was wrapped, rather than the original error, which complicates assertions with errors.Cause/errors.Unwrap. Signed-off-by: Maksim An <maksiman@microsoft.com>
4ad4603
to
04bf58a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides the error comment
Signed-off-by: Maksim An <maksiman@microsoft.com>
Assigned myself here #1258 and assigned you to this PR, might as well as they're both some what in the same realm 😝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small question, otherwise lgtm
Signed-off-by: Maksim An <maksiman@microsoft.com>
Make sure to assert the value of dmveritySuperblock.Signature before trying to read the root hash. Without the check, any valid footer with with valid size would be treated as a dm-verity superblock. Additionally wrap original Read errors, rather than custom errors. In some places when returning an error from ReadDMVeritySuperBlock, a custom error was wrapped, rather than the original error, which complicates assertions with errors.Cause/errors.Unwrap. Add unit tests to cover other edge cases. Signed-off-by: Maksim An <maksiman@microsoft.com>
Make sure to assert the value of dmveritySuperblock.Signature before
trying to read the root hash, without the check, any valid footer would
be treated as a dm-verity superblock.
Add unit tests to cover other edge cases.
Signed-off-by: Maksim An maksiman@microsoft.com