From 1676fffaadd06b727683896e406146dc066baf86 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 14 Jan 2022 09:23:30 +0000 Subject: [PATCH] vmm: Check shared memory is enabled for local migration This is required so that the receiving process can access the existing process's memory. Signed-off-by: Rob Bradford --- vmm/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 3510503d1..3e93848b4 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1153,6 +1153,22 @@ impl Vmm { "Sending migration: destination_url = {}, local = {}", send_data_migration.destination_url, send_data_migration.local ); + + if !self + .vm_config + .as_ref() + .unwrap() + .lock() + .unwrap() + .memory + .shared + && send_data_migration.local + { + return Err(MigratableError::MigrateSend(anyhow!( + "Local migration requires shared memory enabled" + ))); + } + if let Some(vm) = self.vm.as_mut() { Self::send_migration( vm,