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

vhost_user: handle recv_with_fds being unsafe #69

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

alyssais
Copy link
Contributor

recv_with_fds from vmm-sys-util was never safe, but was incorrectly not marked as safe. Handle it safely in every function where we have enough information to know that calling it will be safe, and propogate the unsafe to any function where we don't.

Fortunately this is quite straightforward now all of the high-level methods have the guarantee that they're returning ByteValued types.

Signed-off-by: Alyssa Ross hi@alyssa.is


This change is necessitated by rust-vmm/vmm-sys-util#135. If it's merged before the vmm-sys-util dependency is updated to a version with that change, it will produce compiler warnings, so I've marked it as a draft until that PR is merged.

@jiangliu
Copy link
Member

Hi alyssais, could you please help to fix the CI failures?

@alyssais
Copy link
Contributor Author

@jiangliu the CI failures are just coming from the unsafe blocks I added not being required yet because we haven't bumped vhost's vmm-sys-util dependency.

Should I change Cargo.toml to have it use the latest vmm-sys-util from git, or would you like to do a vmm-sys-util release including the latest changes that we could update to?

@jiangliu
Copy link
Member

@jiangliu the CI failures are just coming from the unsafe blocks I added not being required yet because we haven't bumped vhost's vmm-sys-util dependency.

Should I change Cargo.toml to have it use the latest vmm-sys-util from git, or would you like to do a vmm-sys-util release including the latest changes that we could update to?

Hi @alyssais , we have just published vmm-sys-util v0.9.0, could you please give another try?

recv_with_fds from vmm-sys-util was never safe, but was incorrectly
not marked as safe.  Handle it safely in every function where we have
enough information to know that calling it will be safe, and propogate
the unsafe to any function where we don't.

Fortunately this is quite straightforward now all of the high-level
methods have the guarantee that they're returning ByteValued types.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
@alyssais alyssais marked this pull request as ready for review September 14, 2021 18:20
Copy link
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@slp slp merged commit 3355764 into rust-vmm:main Sep 15, 2021
@alyssais alyssais deleted the unsafe_iovec branch May 19, 2024 19:27
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.

4 participants