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

Expose optimized fsverity interface to Rust #357

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

cgwalters
Copy link
Contributor

On the C side we have two functions:

  • lcfs_compute_fsverity_from_fd
  • lfs_fd_get_fsverity

The first is currently defined to operate purely in memory. The second checks if fsverity is already enabled on the fd, and if so just asks the kernel for it; falling back to the first case otherwise.

I'm actually not entirely sure if we really need both; it seems like if we have a fd we'd basically always want to use the kernel code if possible.

Out of conservatism for now, expose both on the composefs-sys Rust binding side. But on the high level interface just change what we're using to be backed by lcfs_fd_get_fsverity().

If someone really cares later of course we can add sugar for the pure compute path in the high level Rust API too.

On the C side we have two functions:

- `lcfs_compute_fsverity_from_fd`
- `lfs_fd_get_fsverity`

The first is currently defined to operate purely in memory.
The second checks if fsverity is already enabled on the fd,
and if so just asks the kernel for it; falling back to the
first case otherwise.

I'm actually not entirely sure if we really need both; it
seems like if we have a fd we'd basically always want to use
the kernel code if possible.

Out of conservatism for now, expose both on the composefs-sys Rust
binding side. But on the high level interface just change what
we're using to be backed by `lcfs_fd_get_fsverity()`.

If someone really cares later of course we can add sugar
for the pure compute path in the high level Rust API too.

Signed-off-by: Colin Walters <[email protected]>
@allisonkarlitskaya
Copy link
Collaborator

I kinda wonder if we want to rather implement more of this stuff in Rust.....

Copy link
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

@cgwalters cgwalters merged commit 5ed1fb6 into containers:main Sep 23, 2024
14 checks passed
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