Skip to contentSkip to conversation

fix qemu crash with kvm enabled.

PATCH Superseded Gerd Hoffmann 1 participant 1 message Dec 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix qemu crash with kvm enabled.

Hi,

Without this initialization fix the kvm ioctl will overflow msr_list, thereby killing the stack and crash qemu.

please apply,
Gerd

Quoted 1 line

From 00aa7c185585ebfcddf481acfa3f0b5ab9e41486 Mon Sep 17 00:00:00 2001

From: Gerd Hoffmann <[email protected]>
Date: Tue, 9 Dec 2008 17:42:27 +0100
Subject: [PATCH] Fix qemu crash with kvm enabled.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/kvm.c +1 -1
index effd5af..db11ac2 100644
@@ -104,11 +104,11 @@ static int kvm_has_msr_star(CPUState *env)
 
         /* Obtain MSR list from KVM.  These are the MSRs that we must
          * save/restore */
+        msr_list.nmsrs = 0;
         ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, &msr_list);
         if (ret < 0)
             return 0;
 
-        msr_list.nmsrs = 0;
         kvm_msr_list = qemu_mallocz(sizeof(msr_list) +
                                     msr_list.nmsrs * sizeof(msr_list.indices[0]));
         if (kvm_msr_list == NULL)
Signature · 1 line
1.5.6.5