Skip to content
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

Merged
merged 4 commits into from
Jan 13, 2022

Conversation

anmaxvl
Copy link
Contributor

@anmaxvl anmaxvl commented Dec 29, 2021

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

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>
@anmaxvl anmaxvl requested a review from a team as a code owner December 29, 2021 18:42
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>
@anmaxvl anmaxvl force-pushed the fix-read-dmverity-superblock branch from 4ad4603 to 04bf58a Compare December 30, 2021 21:37
@dcantah dcantah self-assigned this Jan 4, 2022
ext4/dmverity/dmverity.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dcantah dcantah left a 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>
@dcantah
Copy link
Contributor

dcantah commented Jan 5, 2022

Assigned myself here #1258 and assigned you to this PR, might as well as they're both some what in the same realm 😝

Copy link
Contributor

@katiewasnothere katiewasnothere left a 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>
@anmaxvl anmaxvl merged commit 617d439 into microsoft:master Jan 13, 2022
@anmaxvl anmaxvl deleted the fix-read-dmverity-superblock branch January 13, 2022 20:12
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
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>
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.

3 participants