qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RESEND PATCH] Fix qemu crash with kvm enabled.


From: Gerd Hoffmann
Subject: [Qemu-devel] [RESEND PATCH] Fix qemu crash with kvm enabled.
Date: Mon, 15 Dec 2008 23:41:55 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081119)

  Hi,

If you see crashes after commit 6060, try this one ;)

Not initializing msr_list.nmsrs before the KVM_GET_MSR_INDEX_LIST ioctl
will make the kernel fill too much data into msr_list, thereby
overflowing the stack and crashing the qemu.

cheers,
  Gerd
>From cb6c5b6fde117fe05699230c43c3163e91dbb3cd 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]