From: Stefan Weil <weil@mail.berlios.de>
To: Anthony Liguori <anthony@codemonkey.ws>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel][BUG][PATCH] Fix crash in kvm.c
Date: Sat, 06 Dec 2008 11:00:13 +0100 [thread overview]
Message-ID: <493A4D2D.4060300@mail.berlios.de> (raw)
In-Reply-To: <4939B2F3.5060307@codemonkey.ws>
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
Anthony Liguori schrieb:
> Stefan Weil wrote:
>> Anthony Liguori schrieb:
>>
>>> 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.
>>>
>>
>> The essential change was to replace "int i" by "unsigned i".
>> i = 0x80000000 is negative, so the for loop went until there was an
>> access fault.
>>
>
> We should change limit too, right?
>
> Regards,
>
> Anthony Liguori
>
Right, and cpuid_i, too. "uint32_t" is even better than "unsigned".
Here is a new patch, now without assertions, so it can be applied to
Qemu trunk.
Regards
Stefan
[-- Attachment #2: kvm.patch --]
[-- Type: text/x-diff, Size: 504 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 (working copy)
@@ -39,7 +39,7 @@
struct kvm_cpuid cpuid;
struct kvm_cpuid_entry entries[100];
} __attribute__((packed)) cpuid_data;
- int limit, i, cpuid_i;
+ uint32_t limit, i, cpuid_i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
next prev parent reply other threads:[~2008-12-06 10:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2008-12-11 21:03 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=493A4D2D.4060300@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).