From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruO-0006xC-VM for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ruN-0002hY-PR for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:28 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:61109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruN-0002gN-Dw for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:27 -0400 Received: by mail-gh0-f173.google.com with SMTP id r17so31193ghr.4 for ; Tue, 21 Aug 2012 10:06:27 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Tue, 21 Aug 2012 12:05:39 -0500 Message-Id: <1345568757-14365-6-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 05/23] kvmvapic: Disable if there is insufficient memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com From: Jan Kiszka 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 (cherry picked from commit a9605e0317c7a6d5e68f3a3b6708c8ef1096f4bc) Signed-off-by: Michael Roth --- hw/apic_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/apic_common.c b/hw/apic_common.c index 60b8259..e4612bb 100644 --- a/hw/apic_common.c +++ b/hw/apic_common.c @@ -289,7 +289,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; -- 1.7.9.5