Skip to content

composefs: Properly add verity info to generated dump file#816

Open
alexlarsson wants to merge 1 commit into
containers:mainfrom
alexlarsson:fix-composefs-verity
Open

composefs: Properly add verity info to generated dump file#816
alexlarsson wants to merge 1 commit into
containers:mainfrom
alexlarsson:fix-composefs-verity

Conversation

@alexlarsson
Copy link
Copy Markdown
Contributor

The payloads in the dump files are relative, but the verityDigests map has absolute filenames.

Also, lets only look for verity digests for regular files, not fot e.g. symlinks (where the payload is the target of the link).

@github-actions github-actions Bot added the storage Related to "storage" package label May 4, 2026
Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! ACK to the core idea for regular files.


Can you, please, update the unit test to be more realistic? We shouldn’t be able to make such a change without unit tests failing.

(Perhaps even run each current test case twice, once with digests and once without? That would need manipulating the expected data…)

digest := verityDigests[payload]
digest := ""
if entry.Type == minimal.TypeReg || entry.Type == minimal.TypeLink {
digest = verityDigests["/"+payload]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICS the map is only updated when writing regular files, not hard links.

So, if, for a hard link the “payload” is a link to another file as seen in the composefs mount, this will never find an entry for a hard link. Am I missing anything?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you're right, I just didn't completely think through the hardlink case. For hardlinks we don't need to generate any expected digest, because it will just use whatever was specified for the target that they payload points at.

So, we're fine with just if entry.Type == minimal.TypeReg here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

digest := verityDigests[payload]
digest := ""
if entry.Type == minimal.TypeReg || entry.Type == minimal.TypeLink {
digest = verityDigests["/"+payload]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, pre-existing: Should this, really, fail if an entry isn’t found and we expect one?

I guess ideally we would differentiate between verityDigest == nil (not available) and != nil (available and expected to be fully populated), but that’s not what the chunked code currently produces.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, probably. I mean, there are two usecases here, first, we don't care about verity at all, and secondly, we want to require verity for all regular file accesses. And in the first case you either do it right or pass a nil, and in the second we really do want to error out during image creation, not at runtime when accessing a file.

@mtrmac
Copy link
Copy Markdown
Contributor

mtrmac commented May 4, 2026

@giuseppe I think containers/fuse-overlayfs#457 changed the build system and broke our CI here…

@Luap99
Copy link
Copy Markdown
Member

Luap99 commented May 4, 2026

@giuseppe I think containers/fuse-overlayfs#457 changed the build system and broke our CI here…

I am working on a fix here #818

The payloads in the dump files are relative, but the verityDigests
map has absolute filenames.

Also, lets only look for verity digests for regular files, not fot
e.g. symlinks (where the payload is the target of the link).

Signed-off-by: Alexander Larsson <alexl@redhat.com>
@alexlarsson alexlarsson force-pushed the fix-composefs-verity branch from 1051eb9 to b8fa3ea Compare May 5, 2026 08:23
@alexlarsson
Copy link
Copy Markdown
Contributor Author

I rebased for the ci fix, added some tests and removed the lookup for hardlinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

storage Related to "storage" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants