qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [patch] fix qemu crash with kvm enabled.


From: Gerd Hoffmann
Subject: [Qemu-devel] [patch] fix qemu crash with kvm enabled.
Date: Tue, 09 Dec 2008 17:46:31 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081119)

  Hi,

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

please apply,
  Gerd
>From 00aa7c185585ebfcddf481acfa3f0b5ab9e41486 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <address@hidden>
Date: Tue, 9 Dec 2008 17:42:27 +0100
Subject: [PATCH] Fix qemu crash with kvm enabled.


Signed-off-by: Gerd Hoffmann <address@hidden>
---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index effd5af..db11ac2 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -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)
-- 
1.5.6.5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]