From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeN4l-0001ol-5Z for qemu-devel@nongnu.org; Thu, 07 Nov 2013 05:44:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeN4f-0007wa-5e for qemu-devel@nongnu.org; Thu, 07 Nov 2013 05:44:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeN4e-0007wP-Tw for qemu-devel@nongnu.org; Thu, 07 Nov 2013 05:44:29 -0500 From: Marcel Apfelbaum Date: Thu, 7 Nov 2013 12:41:20 +0200 Message-Id: <1383820884-29596-5-git-send-email-marcel.a@redhat.com> In-Reply-To: <1383820884-29596-1-git-send-email-marcel.a@redhat.com> References: <1383820884-29596-1-git-send-email-marcel.a@redhat.com> Subject: [Qemu-devel] [PATCH for-1.7 v2 4/8] exec: don't ignore high address bits on lookup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, agraf@suse.de, lcapitulino@redhat.com, aliguori@amazon.com, pbonzini@redhat.com, afaerber@suse.de From: "Michael S. Tsirkin" Lookup of address > target address space should return an unassigned section, instead of silently ignoring high bits. Reported-by: Luiz Capitulino Signed-off-by: Michael S. Tsirkin Signed-off-by: Marcel Apfelbaum --- exec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exec.c b/exec.c index 79610ce..aeeaf00 100644 --- a/exec.c +++ b/exec.c @@ -197,6 +197,9 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr *index, } } +#define TARGET_PHYS_MAX_ADDR \ + (0x1ULL << (TARGET_PHYS_ADDR_SPACE_BITS - TARGET_PAGE_BITS)) + static void phys_page_set(AddressSpaceDispatch *d, hwaddr index, hwaddr nb, uint16_t leaf) @@ -213,6 +216,10 @@ static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr index, PhysPageEntry *p; int i; + if (index >= TARGET_PHYS_MAX_ADDR) { + return §ions[PHYS_SECTION_UNASSIGNED]; + } + for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) { if (lp.ptr == PHYS_MAP_NODE_NIL) { return §ions[PHYS_SECTION_UNASSIGNED]; -- 1.8.3.1