Repository navigation
The extended attributes of an image that says its shared entries are in a metabox it does not have are refused, as the kernel fails their listing - #304
Open
closer-claudio wants to merge 1 commit into
Conversation
… are refused The compat feature SHARED_EA_IN_METABOX says an image's shared xattr entries are read through its metabox inode. Open takes no image with a metabox (the incompat feature is refused), so an image it opens with that compat bit set has none. The kernel mounts such an image, and fails the listing of every inode that has an xattr body with EFSCORRUPTED: erofs_listxattr runs the shared pass after the inline one, and erofs_xattr_iter_shared begins with the metabox's buffer, which erofs_init_metabuf refuses when there is no metabox inode, before it looks at the inode's shared count (xattr.c, data.c). An inode with no xattr body, and every file's data, are served as in any other image. The reader ignored the bit and served the shared entries it found in the plain xattr area, where the image says they are not, and so did the copy of an image and the reference model the tests judge the reader by. Now an inode with an xattr body in such an image is ErrCorrupt where its xattrs are read: at Stat, which carries them, and in the copy of an image, which decodes them itself. Reading a file's data needs no Stat and is served. The reference model refuses the same listing, in the kernel's order: after the inline entries, before the shared ones. TestContractSharedXattrsInAMetaboxTheImageDoesNotHave: every committed image without a blob, the bit set and the checksum redone: it opens; each inode that has an xattr body, by the reference model, is ErrCorrupt at Lstat, and each that has none is served; every regular file reads the bytes it read before; a copy, with data and metadata-only, is refused when an inode has a body. Two fuzz seeds already set the bit, and agree with the reference only when both refuse. TestReaderCompactInodeMtime set the whole compat byte to a fuzzer's value, this bit among them, to clear the checksum; it now clears the checksum bit alone. For #272 Signed-off-by: closer-claudio <claudio@farcloser.world> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
closer-claudio
enabled auto-merge
November 23, 2026 09:13
Author
|
Reviewed at 7e23fd9 |
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.
The defect
The compat feature
SHARED_EA_IN_METABOXsays an image's shared extended attribute entries are read through its metabox inode.Opentakes no image with a metabox (the incompat feature is refused), so an image it opens with that compat bit set has none.The reader ignored the bit and served the shared entries it found in the plain xattr area, where the image says they are not. So did the copy of an image, and the reference model the tests judge the reader by.
What the kernel does
Read from the source (v7.4-rc3,
fs/erofs/xattr.c,data.c,super.c), not run.The kernel mounts such an image: nothing refuses the compat bit alone. It then fails the listing of every inode that has an xattr body with
EFSCORRUPTED.erofs_listxattrruns the shared pass after the inline one, anderofs_xattr_iter_sharedbegins with the metabox's buffer, whicherofs_init_metabufrefuses when there is no metabox inode, before it looks at the inode's shared count. An inode whose body holds inline entries only fails the same way. An inode with no xattr body, and every file's data, are served as in any other image.The change
An inode with an xattr body in such an image is
ErrCorruptwhere its xattrs are read: atStat, which carries them, and in the copy of an image, which decodes them itself. The reference model refuses the same listing, in the kernel's order: after the inline entries, before the shared ones.What a consumer sees
For an image with that bit and no metabox:
Stat,LstatandReadDir'sInfoof an inode that has an xattr body returnErrCorrupt, where they returned attributes read from the wrong place.Statand is served as before.CopyFromof such an image is refused when an inode has a body.Where this follows the package's shape and not the kernel's: the kernel's
statsucceeds for such an inode and only its xattr calls fail; hereStatcarries the attributes, so it isStatthat fails.mkfs.erofssets the bit only together with a metabox, so no image it writes is affected.Evidence
TestContractSharedXattrsInAMetaboxTheImageDoesNotHave: every committed image without a blob, the bit set and the checksum redone. It opens; each inode that has an xattr body, by the reference model, isErrCorruptatLstat, and each that has none is served; every regular file reads the bytes it read before; a copy, with data and metadata-only, is refused when an inode has a body. Two fuzz seeds already set the bit, and agree with the reference only when both refuse.TestReaderCompactInodeMtimewrote a fuzzer's whole compat byte, this bit among them, to clear the checksum; it now clears the checksum bit alone.just lintandjust testpass.For #272