From patchwork Wed Jul 25 22:45:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Hall X-Patchwork-Id: 173312 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 DB0A72C0096 for ; Thu, 26 Jul 2012 11:09:03 +1000 (EST) Received: from localhost ([::1]:36313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuCZY-0000Mj-Uz for incoming@patchwork.ozlabs.org; Wed, 25 Jul 2012 21:09:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuAPO-0003Bh-Hp for qemu-devel@nongnu.org; Wed, 25 Jul 2012 18:50:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuAPN-00020R-Lc for qemu-devel@nongnu.org; Wed, 25 Jul 2012 18:50:22 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:51270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuAPN-00020N-Ge; Wed, 25 Jul 2012 18:50:21 -0400 Received: by yhpp34 with SMTP id p34so1295260yhp.4 for ; Wed, 25 Jul 2012 15:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=32IJ9I1bRCpCqtd3eVYO8M5tikEhnzGcRrZwDZqeSpY=; b=ZjiDRunSEyjepvh5yRw7LQPbHBMb8qdgQVGtf0gOS5wpHmo548w5b+ZNiEbLaxgnXW 7VooJ4Albj7wK1bdYd97S0bbDFt4L86/k/1dsNX53np9pIQc4uIw9ZPQWHMquh572gE1 /RCa6rR+frtRATAn/FeSOKu904YRiQ/yL1TDRcNHKC6c93NVd3blHAOWVtWLwsbNtKNP pQPBgiBgPRJcNJEe4+llfeGgj94aJEIkIMXofLks9UUJQ328rqQ+HX3RELee6L2Qrv9e MqgSIL0GFfVz/0b2rDhcmj/RDCA4AiNP0RS/jEywsZj9BETcWR0/NwXOk/1u4gf6gkeP jT9g== Received: by 10.236.191.42 with SMTP id f30mr25244219yhn.123.1343256620498; Wed, 25 Jul 2012 15:50:20 -0700 (PDT) Received: from localhost.localdomain (cpe-69-23-225-27.natcky.res.rr.com. [69.23.225.27]) by mx.google.com with ESMTPS id i34sm19947662anm.12.2012.07.25.15.50.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 15:50:19 -0700 (PDT) From: Tyler Hall To: qemu-devel@nongnu.org Date: Wed, 25 Jul 2012 18:45:03 -0400 Message-Id: <1343256304-32029-1-git-send-email-tylerwhall@gmail.com> X-Mailer: git-send-email 1.7.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.45 X-Mailman-Approved-At: Wed, 25 Jul 2012 21:08:52 -0400 Cc: qemu-trivial@nongnu.org, Tyler Hall Subject: [Qemu-devel] [PATCH 1/2] 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 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 --- 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)); }