* [Qemu-devel][BUG][PATCH] Fix crash in kvm.c
@ 2008-12-05 22:15 Stefan Weil
2008-12-05 22:37 ` Anthony Liguori
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2008-12-05 22:15 UTC (permalink / raw)
To: QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
I got a crash (array access out of bounds results in access fault)
with the current Qemu trunk when kvm is enabled:
qemu -fda fd.img -cdrom cdrom.img -hda hda.img -hdb raw.img -m 256 -boot
c -enable-kvm
Host is Debian x86_64, the crash occurs before any code is emulated.
With the patch, the emulation (Win 98) boots, but has problems with the
display of
icons and the mouse cursor. Qemu displays lots of
"BUG: kvm_physical_sync_dirty_bitmap: invalid parameters" messages.
Stefan
[-- Attachment #2: kvm.patch --]
[-- Type: text/x-diff, Size: 1125 bytes --]
Fix crash with kvm enabled.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Index: target-i386/kvm.c
===================================================================
--- target-i386/kvm.c (Revision 5889)
+++ target-i386/kvm.c (Arbeitskopie)
@@ -12,6 +12,7 @@
*
*/
+#include <assert.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -39,7 +40,8 @@
struct kvm_cpuid cpuid;
struct kvm_cpuid_entry entries[100];
} __attribute__((packed)) cpuid_data;
- int limit, i, cpuid_i;
+ int limit, cpuid_i;
+ unsigned i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
@@ -49,6 +51,7 @@
for (i = 0; i <= limit; i++) {
struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
+ assert(cpuid_i < 100);
cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
c->function = i;
@@ -63,6 +66,7 @@
for (i = 0x80000000; i <= limit; i++) {
struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
+ assert(cpuid_i < 100);
cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
c->function = i;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel][BUG][PATCH] Fix crash in kvm.c
2008-12-05 22:15 [Qemu-devel][BUG][PATCH] Fix crash in kvm.c Stefan Weil
@ 2008-12-05 22:37 ` Anthony Liguori
[not found] ` <4939B25F.8030203@mail.berlios.de>
0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2008-12-05 22:37 UTC (permalink / raw)
To: qemu-devel, Glauber de Oliveira Costa, Stefan Weil
Stefan Weil wrote:
> I got a crash (array access out of bounds results in access fault)
> with the current Qemu trunk when kvm is enabled:
>
> qemu -fda fd.img -cdrom cdrom.img -hda hda.img -hdb raw.img -m 256 -boot
> c -enable-kvm
>
> Host is Debian x86_64, the crash occurs before any code is emulated.
>
Is the patch incomplete, perhaps? It seems to just add asserts which
shouldn't fix anything.
I don't think any leaf should return a max leaf greater than 100
elements so I'd be pretty surprised to see this happen. I'd really like
to see the back trace to see which leaf is the problematic one and what
the greatest leaf being reported is.
> With the patch, the emulation (Win 98) boots, but has problems with the
> display of
> icons and the mouse cursor. Qemu displays lots of
> "BUG: kvm_physical_sync_dirty_bitmap: invalid parameters" messages.
>
It looks like Avi and Glauber found some bugs in this code. There are
patches for kvm-userspace right now that need porting to QEMU. I'll
take a look at that this weekend unless Glauber was already planning too.
Regards,
Anthony Liguori
> Stefan
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-11 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-05 22:15 [Qemu-devel][BUG][PATCH] Fix crash in kvm.c Stefan Weil
2008-12-05 22:37 ` Anthony Liguori
[not found] ` <4939B25F.8030203@mail.berlios.de>
[not found] ` <4939B2F3.5060307@codemonkey.ws>
2008-12-06 10:00 ` Stefan Weil
2008-12-11 21:03 ` Anthony Liguori
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).