From patchwork Fri Aug 3 10:51:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 174973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A330F2C0091 for ; Fri, 3 Aug 2012 20:51:54 +1000 (EST) Received: from localhost ([::1]:39214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFU0-0000yg-GB for incoming@patchwork.ozlabs.org; Fri, 03 Aug 2012 06:51:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFTa-0000Zz-1H for qemu-devel@nongnu.org; Fri, 03 Aug 2012 06:51:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxFTT-0005Lk-TS for qemu-devel@nongnu.org; Fri, 03 Aug 2012 06:51:25 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:40902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFTT-0005LI-KE for qemu-devel@nongnu.org; Fri, 03 Aug 2012 06:51:19 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2012 11:51:18 +0100 Received: from d06nrmr1407.portsmouth.uk.ibm.com (9.149.38.185) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 3 Aug 2012 11:51:17 +0100 Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q73ApGku2957420 for ; Fri, 3 Aug 2012 11:51:16 +0100 Received: from d06av03.portsmouth.uk.ibm.com (localhost.localdomain [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q73ApGgP012467 for ; Fri, 3 Aug 2012 04:51:16 -0600 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.145]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q73ApFwj012441; Fri, 3 Aug 2012 04:51:15 -0600 From: Stefan Hajnoczi To: Anthony Liguori Date: Fri, 3 Aug 2012 11:51:04 +0100 Message-Id: <1343991066-9814-6-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343991066-9814-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1343991066-9814-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12080310-5024-0000-0000-00000369D570 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.107 Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Tyler Hall Subject: [Qemu-devel] [PATCH 5/7] exec.c: Fix off-by-one error in register_subpage 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 From: Tyler Hall subpage_register() expects "end" to be the last byte in the mapping. Registering a non-page-aligned memory region that extends up to or beyond a page boundary causes subpage_register() to silently fail through the (end >= PAGE_SIZE) check. This bug does not cause noticeable problems for mappings that do not extend to a page boundary, though they do register an extra byte. Signed-off-by: Tyler Hall Reviewed-by: Peter Maydell Reviewed-by: Avi Kivity Signed-off-by: Stefan Hajnoczi --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index feb4795..27b100c 100644 --- a/exec.c +++ b/exec.c @@ -2271,7 +2271,7 @@ static void register_subpage(MemoryRegionSection *section) subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; - end = start + section->size; + end = start + section->size - 1; subpage_register(subpage, start, end, phys_section_add(section)); }