From patchwork Wed Nov 6 17:39:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 288979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2268F2C00C8 for ; Thu, 7 Nov 2013 04:40:28 +1100 (EST) Received: from localhost ([::1]:35216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve75e-0005nC-3n for incoming@patchwork.ozlabs.org; Wed, 06 Nov 2013 12:40:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve75D-0005i7-Lk for qemu-devel@nongnu.org; Wed, 06 Nov 2013 12:40:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve751-0000dA-Hv for qemu-devel@nongnu.org; Wed, 06 Nov 2013 12:39:59 -0500 Received: from mail-qe0-x22f.google.com ([2607:f8b0:400d:c02::22f]:50493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve751-0000d5-DO for qemu-devel@nongnu.org; Wed, 06 Nov 2013 12:39:47 -0500 Received: by mail-qe0-f47.google.com with SMTP id b4so6495742qen.6 for ; Wed, 06 Nov 2013 09:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=GxodXPd8KLo6TCPdmLYgtPmoRqKnl477ux9YsoclU5Q=; b=LLo3T6vMJJELWC7W7Ef4cNKk2U9wb7Oo3VYm6Zxg2NvVKMkGIR5Vt2ECEn9tsyUydj zA7IdB/TadStW/9oHrXmYbZpk1iFyX1ZlnRpBLz1mXg5klvYpeu2HmqREmm5khAS4ZLI 4f9GhZpBmkTlUhqwOt+V5WKMpQUutrj7kR87xFu4vj3rlLf+A7bSPYAYOQ91B8b2/uvF TnlmXsuLhvesVPkACqXVcHemlzptrNr5HlaxFMFZUxuLlJaCsV9BzQZne9EVBA05oV+C WPw4BOXgLX/jkoFQnxNdx6XcjbaW54H5H29hkUsfdOHDE+IYDrvqKmU+sXO+ctFpSgqq QkSQ== X-Received: by 10.224.38.74 with SMTP id a10mr7745240qae.10.1383759586950; Wed, 06 Nov 2013 09:39:46 -0800 (PST) Received: from yakj.usersys.redhat.com (net-37-117-137-113.cust.dsl.vodafone.it. [37.117.137.113]) by mx.google.com with ESMTPSA id v19sm81617246qaw.0.2013.11.06.09.39.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 09:39:45 -0800 (PST) Message-ID: <527A7EDE.3060409@redhat.com> Date: Wed, 06 Nov 2013 18:39:42 +0100 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 MIME-Version: 1.0 To: Luiz Capitulino References: <20131106112214.14a448b6@redhat.com> In-Reply-To: <20131106112214.14a448b6@redhat.com> X-Enigmail-Version: 1.6 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::22f Cc: mst@redhat.com, qemu-devel , marcel.a@redhat.com Subject: Re: [Qemu-devel] BUG: QEMU aborts when setting breakpoint in gdb (bisected) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Il 06/11/2013 17:22, Luiz Capitulino ha scritto: > 1. Run qemu with gdb server support > > # qemu [...] -s -S > > 2. Connect gdb and try to set a breakpoint > > $ gdb /path/to/vmlinux > (gdb) target remote:1234 > (gdb) b secondary_startup_64 (Note that this doesn't make much sense until the kernel has been loaded into memory. You probably want hbreak instead). > 3. On qemu terminal > > qemu-qmp: /home/lcapitulino/work/src/upstream/qmp-unstable/include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed. > Aborted (core dumped) > > According to bisect the culprit is: > > commit a53ae8e934cd54686875b5bcfc2f434244ee55d6 > Author: Marcel Apfelbaum > Date: Mon Sep 16 11:21:16 2013 +0300 > > hw/pci: partially handle pci master abort I couldn't get quite the same reproducer, mine was: $ gdb (gdb) set arch i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) target remote localhost:1234 Remote debugging using localhost:1234 The problem is that gdb attempts to read a few bytes from address 0xffffffffffffffe6 to 0xffffffffffffffff inclusive. The region it gets is the (newly introduced) master abort region, which is as big as the PCI address space (see pci_bus_init). Due to a typo that's only 2^63-1, not 2^64. But we get it anyway because phys_page_find ignores the upper bits of the physical address. In address_space_translate_internal then diff = int128_sub(section->mr->size, int128_make64(addr)); *plen = int128_get64(int128_min(diff, int128_make64(*plen))); Tested-by: Luiz Capitulino diff becomes negative, and int128_get64 booms. Will send as a proper patch tomorrow... can you give your Tested-by? diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b3d94bd..68901c3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -114,7 +114,7 @@ static void pc_init1(QEMUMachineInitArgs *args, if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); - memory_region_init(pci_memory, NULL, "pci", INT64_MAX); + memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 2e315f7..c9a03fc 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -101,7 +101,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) /* pci enabled */ if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); - memory_region_init(pci_memory, NULL, "pci", INT64_MAX); + memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL;