From 86f5029a284c38480bc7b2627aa4beb262c20074 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti <mtosatti@redhat.com> Date: Tue, 13 Jan 2009 18:36:17 -0200 Subject: [PATCH 66/70] kvm: qemu: make --mem-path memory allocation depend on mmu notifiers Without mmu notifiers usage of hugepages to back guest memory can cause memory corruption. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: applied(kvm/master) Acked-by: Marcelo Tosatti <mtosatti@redhat.com> --- qemu/vl.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/qemu/vl.c b/qemu/vl.c index 187d39e..3276698 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -4801,6 +4801,11 @@ void *alloc_mem_area(size_t memory, unsigned long *len, const char *path) int flags; #endif + if (!kvm_has_sync_mmu()) { + fprintf(stderr, "host lacks mmu notifiers, disabling --mem-path\n"); + return NULL; + } + if (asprintf(&filename, "%s/kvm.XXXXXX", path) == -1) return NULL; -- 1.6.1