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

overlay: move the fs-verity measurement to the chunked package #1804

Merged
merged 4 commits into from Jan 22, 2024

Conversation

giuseppe
Copy link
Member

move the logic to calculate the fs-verity for the files payload to the chunked package, so it is calculated when the files are first created.

@giuseppe giuseppe force-pushed the fsverity-package branch 2 times, most recently from 7d1962d to ba3e8cf Compare January 17, 2024 15:03
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Jan 18, 2024

@alexlarsson PTAL

// If it is not required, ignore the error if the filesystem does not support it.
if errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENOTTY) {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not return err here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess maybe we shouldn't fail if the error is "already enabled", so we'll get the error in the measure call? If so, maybe add a comment about this?

Copy link
Member Author

Choose a reason for hiding this comment

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

EnableVerity doesn't return an error on EEXIST, I'll add a comment to make it clearer


err := fsverity.EnableVerity(path, int(roFile.Fd()))
if err != nil {
if c.useFsVerity == graphdriver.DifferFsVerityRequired {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should handle EEXIST for the fs-verity already enabled case and make sure to then read and record the existing digest.

Copy link
Member Author

Choose a reason for hiding this comment

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

fsverity.EnableVerity returns nil if fs-verity was already enabled, so we should already get into the fsverity.MeasureVerity function even if DifferFsVerityRequired

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
avoid to reopen the files twice to calculate their fs-verity digest.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Copy link
Contributor

@alexlarsson alexlarsson 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
Contributor

openshift-ci bot commented Jan 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexlarsson, giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Member

rhatdan commented Jan 22, 2024

:GT<

@rhatdan rhatdan merged commit 2727147 into containers:main Jan 22, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants