Repository navigation
fix(ext4): only validate inode checksums when metadata_csum is enabled - #464
Merged
Merged
Conversation
Collaborator
|
No issues with gating it behind an Why did you bother to write the checksum calculation from: copy(checksumBytes[0:2], b[0x7c:0x7e])
copy(checksumBytes[2:4], b[0x82:0x84])
...
checksum := binary.LittleEndian.Uint32(checksumBytes)To: checksum := uint32(binary.LittleEndian.Uint16(b[0x7c:0x7e])) | uint32(binary.LittleEndian.Uint16(b[0x82:0x84]))<<16Is that not effectively the same thing? |
Contributor
Author
|
avoids an extra allocation, i can change it to the original version if needed |
Contributor
Author
|
*an extra allocation and 2 copies |
Collaborator
Kudos for efficiency, although I don't know how much it matters, but I will not complain if something runs slightly faster at no extra cost. Leave it as you put it. |
deitch
previously approved these changes
Nov 22, 2026
Collaborator
|
Linting error. |
Contributor
Author
|
@deitch fixed |
deitch
approved these changes
Nov 22, 2026
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.
Problem
The ext4 reader validates inode checksums even when
metadata_csumis disabled. Linux does not maintain these checksums in that case, so valid filesystems can fail to read with a checksum mismatch after Linux modifies an inode.Change
Only read and validate inode checksums when the filesystem enables
metadata_csum.Tests
Adds regression cases for disabled checksums with zero or stale values, valid enabled checksums, and rejection of invalid enabled checksums. The disabled-checksum cases fail before the fix and pass afterward.
Also verified read-only access to an affected Linux-written Alpine image.