Skip to content

Commit 036278e

Browse files
committed
allow creation of snapshots of secret hidden VMs
To take snapshots of secret hidden VMs, we need to bounce guest memory through a userspace buffer. Reuse the `Bounce` wrapper type that is already in use for loading the guest kernel / initrd. Signed-off-by: Patrick Roy <[email protected]>
1 parent 92778a2 commit 036278e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vmm/src/vstate/vm.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::persist::{CreateSnapshotError, GuestRegionUffdMapping};
2424
use crate::utils::u64_to_usize;
2525
use crate::vmm_config::snapshot::SnapshotType;
2626
use crate::vstate::memory::{
27-
GuestMemory, GuestMemoryExtension, GuestMemoryMmap, GuestMemoryRegion, GuestRegionMmap,
27+
Bounce, GuestMemory, GuestMemoryExtension, GuestMemoryMmap, GuestMemoryRegion, GuestRegionMmap,
2828
KvmRegion,
2929
};
3030
use crate::vstate::vcpu::VcpuError;
@@ -431,8 +431,12 @@ impl Vm {
431431
.and_then(|_| self.swiotlb_regions().dump_dirty(&mut file, &dirty_bitmap))?;
432432
}
433433
SnapshotType::Full => {
434+
let secret_hidden = self
435+
.guest_memory()
436+
.iter()
437+
.any(|r| r.inner().guest_memfd != 0);
434438
self.guest_memory()
435-
.dump(&mut file)
439+
.dump(&mut Bounce(&file, secret_hidden))
436440
.and_then(|_| self.swiotlb_regions().dump(&mut file))?;
437441
self.reset_dirty_bitmap();
438442
self.guest_memory().reset_dirty();

0 commit comments

Comments
 (0)