-
Notifications
You must be signed in to change notification settings - Fork 107
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 support for KVM_MEMORY_ENCRYPT_{OP,REG_REGION,UNREG_REGION}
#178
Add support for KVM_MEMORY_ENCRYPT_{OP,REG_REGION,UNREG_REGION}
#178
Conversation
b6ccdd4
to
bb78ad4
Compare
This is tricky, since the functionality can only run on SEV-enabled hosts. I guess it would be possible to add a feature flag and guard this functionality and respective tests, although not sure if that's really necessary at this point. |
bb78ad4
to
15f10e2
Compare
|
15f10e2
to
871116a
Compare
Made names shorter, while staying consistent with e.g. https://docs.rs/kvm-ioctls/0.10.0/kvm_ioctls/struct.VmFd.html#method.set_user_memory_region: diff --git a/src/ioctls/vm.rs b/src/ioctls/vm.rs
index ea97cbc..d7faf6d 100644
--- a/src/ioctls/vm.rs
+++ b/src/ioctls/vm.rs
@@ -1283,11 +1283,11 @@ impl VmFd {
/// addr: 0x10000 as u64,
/// size: 0x10000 as u64,
/// };
- /// vm.register_encrypted_memory_region(&memory_region).unwrap();
+ /// vm.register_enc_memory_region(&memory_region).unwrap();
/// ```
///
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
- pub fn register_encrypted_memory_region(&self, memory_region: &kvm_enc_region) -> Result<()> {
+ pub fn register_enc_memory_region(&self, memory_region: &kvm_enc_region) -> Result<()> {
// Safe because we know that our file is a VM fd, we know the kernel will only read the
// correct amount of memory from our pointer, and we verify the return result.
let ret = unsafe { ioctl_with_ref(self, KVM_MEMORY_ENCRYPT_REG_REGION(), memory_region) };
@@ -1321,11 +1321,11 @@ impl VmFd {
/// addr: 0x10000 as u64,
/// size: 0x10000 as u64,
/// };
- /// vm.unregister_encrypted_memory_region(&memory_region).unwrap();
+ /// vm.unregister_enc_memory_region(&memory_region).unwrap();
/// ```
///
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
- pub fn unregister_encrypted_memory_region(&self, memory_region: &kvm_enc_region) -> Result<()> {
+ pub fn unregister_enc_memory_region(&self, memory_region: &kvm_enc_region) -> Result<()> {
// Safe because we know that our file is a VM fd, we know the kernel will only read the
// correct amount of memory from our pointer, and we verify the return result.
let ret = unsafe { ioctl_with_ref(self, KVM_MEMORY_ENCRYPT_UNREG_REGION(), memory_region) }; |
0e51cb3
to
8786591
Compare
8d067f0
to
9bb0da9
Compare
1333183
to
272bfd7
Compare
kcov is counting the lines that are executed by tests on the platform on which it runs, the CI instance doesn't have sev enabled, so the sev functionality covered by your tests won't be executed when running kcov. We are not yet running the CI on AMD, so until that point we can decrease the coverage value :(. |
2d58c38
to
14fdc74
Compare
LE: Laura already replied to this. |
Is there plan to add more for KVM sev commands such as KVM_SEV_LAUNCH_START, KVM_SEV_LAUNCH_UPDATE_DATA? |
AFAIK there was an (unsuccessful?) attempt to add SEV commands in #111. We currently maintain most of SEV-specific functionality externally, but if there is interest here we may consider contributing those. |
The enarx project also makes use of the kvm-bindings/kvm-ioctls crates, so is ti feasible to move some needed data structures from enarx into kvm-ioctls? But I do have some concern about |
We are actually deprecating SEV crate at the moment, so it could be a good chance to salvage useful parts. |
Yes, a good idea to open a new issue for discussion. |
Any update on this? |
Signed-off-by: Roman Volosatovs <[email protected]>
fcf9f46
to
3a2e9e6
Compare
Signed-off-by: Roman Volosatovs <[email protected]>
Co-authored-by: Harald Hoyer <[email protected]> Signed-off-by: Roman Volosatovs <[email protected]>
Co-authored-by: Harald Hoyer <[email protected]> Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
3a2e9e6
to
435b0a4
Compare
|
Thanks! |
Add support for 3
ioctls
:cc @haraldh