qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] fix qemu crash with kvm enabled.
@ 2008-12-09 16:46 Gerd Hoffmann
  0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2008-12-09 16:46 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

  Hi,

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

please apply,
  Gerd

[-- Attachment #2: 0044-Fix-qemu-crash-with-kvm-enabled.patch --]
[-- Type: text/plain, Size: 999 bytes --]

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


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-09 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 16:46 [Qemu-devel] [patch] fix qemu crash with kvm enabled Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).