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

Add kvm guest memfd related capabilities #288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KeyboardNerd
Copy link

Summary of the PR

The capabilities are required to properly setup a guest_memfd to provide better host and guest memory isolation. The memory attributes capability returns an integer with each bits representing different configs. For example, the return integer & KVM_MEMORY_ATTRIBUTE_PRIVATE > 0 means the vm is capable of setting memory pages to private.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@KeyboardNerd KeyboardNerd marked this pull request as ready for review October 9, 2024 23:04
@KeyboardNerd
Copy link
Author

It's a continued discussion from
#284
I accidentally closed that one :(

Copy link
Contributor

@TimePrinciple TimePrinciple left a comment

Choose a reason for hiding this comment

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

Thanks for this work! While I think you could still reopen a PR if you accidentally closed one, if you still have that branch :) Thus we could avoid throwing out PRs

And could you squash 741fb48, 2523d68, 7283cc6 and 3778efe altogether, otherwise we would break bistability along the way 🙂

src/ioctls/vm.rs Outdated Show resolved Hide resolved
src/ioctls/vm.rs Outdated Show resolved Hide resolved
src/ioctls/vm.rs Outdated Show resolved Hide resolved
src/ioctls/vm.rs Outdated Show resolved Hide resolved
@roypat
Copy link
Collaborator

roypat commented Oct 14, 2024

Could you also squash all the commits into one?

@roypat
Copy link
Collaborator

roypat commented Dec 9, 2024

Hey @KeyboardNerd, are you still interested in landing this?

@KeyboardNerd KeyboardNerd force-pushed the memfd branch 3 times, most recently from 4809bf7 to e305451 Compare January 2, 2025 21:55
@KeyboardNerd
Copy link
Author

Hey @KeyboardNerd, are you still interested in landing this?

Yup, now I have cycles to finish this up. The failure comes from "Title: Undefined behaviour in kvm_ioctls::ioctls::vm::VmFd::create_device" same as the one I see in the lastest PR: #301. Not sure about the reason.

Copy link
Collaborator

@roypat roypat left a comment

Choose a reason for hiding this comment

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

Thanks for updating this! Let's update the commit message to reflect what's actually happening here (since the code itself isn't directly mentioning any guest_memfd stuff anymore, even though the checking of attribute support remains the motivation for these functions).

The CI failure I think can be fixed by just changing the version in Cargo.toml to 0.19.1. It's weird that cargo audit picks this up, but oh well lol (fixed in main)

kvm-ioctls/src/ioctls/vm.rs Outdated Show resolved Hide resolved
kvm-ioctls/CHANGELOG.md Outdated Show resolved Hide resolved
The two functions are used to return integer value from
KVM_CHECK_EXTENSION ioctl commands. This is useful for capabilities
returning an integer with each bits representing different configs.

Signed-off-by: Sida Chen <[email protected]>
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