-
Notifications
You must be signed in to change notification settings - Fork 159
vmm: fix non_x86_64 && non-TEE memory region setup #592
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,20 +1,20 @@ | ||||||||
| use std::io; | ||||||||
| use std::sync::{Arc, Mutex}; | ||||||||
|
|
||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use utils::worker_message::MemoryProperties; | ||||||||
| use utils::worker_message::WorkerMessage; | ||||||||
|
|
||||||||
| use crossbeam_channel::Receiver; | ||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use crossbeam_channel::Sender; | ||||||||
|
Comment on lines
+9
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use kvm_bindings::{kvm_memory_attributes, KVM_MEMORY_ATTRIBUTE_PRIVATE}; | ||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use libc::{fallocate, madvise, FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE, MADV_DONTNEED}; | ||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use std::ffi::c_void; | ||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| use vm_memory::{ | ||||||||
| guest_memory::GuestMemory, Address, GuestAddress, GuestMemoryRegion, MemoryRegionAddress, | ||||||||
| }; | ||||||||
|
|
@@ -59,15 +59,21 @@ impl super::Vmm { | |||||||
| .send(self.vm.fd().set_irq_line(irq, active).is_ok()) | ||||||||
| .unwrap(); | ||||||||
| } | ||||||||
| WorkerMessage::ConvertMemory(_sender, _properties) => | ||||||||
| { | ||||||||
| #[cfg(feature = "tee")] | ||||||||
| self.convert_memory(_sender, _properties) | ||||||||
| WorkerMessage::ConvertMemory(_sender, _properties) => { | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| { | ||||||||
| self.convert_memory(_sender, _properties); | ||||||||
| } | ||||||||
|
|
||||||||
| #[cfg(not(all(feature = "tee", target_arch = "x86_64")))] | ||||||||
| { | ||||||||
| let _ = _sender.send(false); | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| #[cfg(feature = "tee")] | ||||||||
| #[cfg(all(feature = "tee", target_arch = "x86_64"))] | ||||||||
| fn convert_memory(&self, sender: Sender<bool>, properties: MemoryProperties) { | ||||||||
| let Some((guest_memfd, region_start)) = self.kvm_vm().guest_memfd_get(properties.gpa) | ||||||||
| else { | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.