summary refs log tree commit diff stats
path: root/accel/stubs/kvm-stub.c
diff options
context:
space:
mode:
authorWilliam Roche <william.roche@oracle.com>2024-01-30 19:06:40 +0000
committerPeter Xu <peterx@redhat.com>2024-02-05 14:41:58 +0800
commit06152b89db64bc5ccec1e54576706ba891654df9 (patch)
treedf0fe21a342e770e23e964332630f18aa0a0221a /accel/stubs/kvm-stub.c
parent39a6e4f87e7b75a45b08d6dc8b8b7c2954c87440 (diff)
downloadfocaccia-qemu-06152b89db64bc5ccec1e54576706ba891654df9.tar.gz
focaccia-qemu-06152b89db64bc5ccec1e54576706ba891654df9.zip
migration: prevent migration when VM has poisoned memory
A memory page poisoned from the hypervisor level is no longer readable.
The migration of a VM will crash Qemu when it tries to read the
memory address space and stumbles on the poisoned page with a similar
stack trace:

Program terminated with signal SIGBUS, Bus error.
#0  _mm256_loadu_si256
#1  buffer_zero_avx2
#2  select_accel_fn
#3  buffer_is_zero
#4  save_zero_page
#5  ram_save_target_page_legacy
#6  ram_save_host_page
#7  ram_find_and_save_block
#8  ram_save_iterate
#9  qemu_savevm_state_iterate
#10 migration_iteration_run
#11 migration_thread
#12 qemu_thread_start

To avoid this VM crash during the migration, prevent the migration
when a known hardware poison exists on the VM.

Signed-off-by: William Roche <william.roche@oracle.com>
Link: https://lore.kernel.org/r/20240130190640.139364-2-william.roche@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'accel/stubs/kvm-stub.c')
-rw-r--r--accel/stubs/kvm-stub.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 1b37d9a302..ca38172884 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -124,3 +124,8 @@ uint32_t kvm_dirty_ring_size(void)
 {
     return 0;
 }
+
+bool kvm_hwpoisoned_mem(void)
+{
+    return false;
+}