From: Jan Kiszka Date: Tue, 14 Aug 2012 11:43:12 +0000 (+0200) Subject: kvmvapic: Disable if there is insufficient memory X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~3747^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9605e0317c7a6d5e68f3a3b6708c8ef1096f4bc;p=sdk%2Femulator%2Fqemu.git kvmvapic: Disable if there is insufficient memory We need at least 1M of RAM to map the option ROM. Otherwise, we will corrupt host memory or even crash: $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k Segmentation fault (core dumped) Reported-and-tested-by: Markus Armbruster Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- diff --git a/hw/apic_common.c b/hw/apic_common.c index 58e63b0..371f95d 100644 --- a/hw/apic_common.c +++ b/hw/apic_common.c @@ -299,7 +299,9 @@ static int apic_init_common(SysBusDevice *dev) sysbus_init_mmio(dev, &s->io_memory); - if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK) { + /* Note: We need at least 1M to map the VAPIC option ROM */ + if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK && + ram_size >= 1024 * 1024) { vapic = sysbus_create_simple("kvmvapic", -1, NULL); } s->vapic = vapic;