From fbe3e4d642df6093e497d93d3d5a54012fe8d90d Mon Sep 17 00:00:00 2001 From: Alexandru Matei Date: Thu, 28 Mar 2024 14:58:10 +0200 Subject: [PATCH] vmm: memory_manager: don't set backing_file for virtio_mem regions The memory region that is associated with the hotpluggable part of a virtio-mem zone isn't backed by the file specified in the MemoryZoneConfig. The file is used only for the fixed part of the zone. When you try to restore a snapshot with virtio-mem, the backing file is used for all its regions. This results in the following error: VmRestore(MemoryManager(GuestMemoryRegion(MappingPastEof))) This patch sets backing_file only for the fixed part of a virtio-mem zone. Fixes: #6337 Signed-off-by: Alexandru Matei --- vmm/src/memory_manager.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index 89ea38d8f..2a7ecd2d5 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -671,7 +671,11 @@ impl MemoryManager { for zone_config in zones_config { if guest_ram_mapping.zone_id == zone_config.id { let region = MemoryManager::create_ram_region( - &zone_config.file, + if guest_ram_mapping.virtio_mem { + &None + } else { + &zone_config.file + }, guest_ram_mapping.file_offset, GuestAddress(guest_ram_mapping.gpa), guest_ram_mapping.size as usize,