From nobody Wed Nov 5 09:31:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499482352090291.95450185395623; Fri, 7 Jul 2017 19:52:32 -0700 (PDT) Received: from localhost ([::1]:59562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfrC-0002PX-Lb for importer@patchew.org; Fri, 07 Jul 2017 22:52:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfpf-0001Sb-9C for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTfpe-0004xX-CW for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:50:55 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTfpe-0004xM-7x; Fri, 07 Jul 2017 22:50:54 -0400 Received: by mail-qk0-x244.google.com with SMTP id p21so6558356qke.0; Fri, 07 Jul 2017 19:50:54 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id q90sm3793925qki.11.2017.07.07.19.50.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jul 2017 19:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BHq3V6wgsHmxbKumrTk0927GbDnWp342NVcNICOr4+M=; b=pRjLOHuesPhQ/syuSWajWtChdAID5lfv6N35L+WSU8DTvUlfghVBSHViXKi9eHu7oX Afqyhl+7yx10EJBvcg7GY/b+7eDcoAbuoxGpwyN7VTXTx8/o3MPytZEauX8ejCkXwhle PyNfEa75eM+gu5rPARQTTJa8NQMVwCuZfUfpmqAu+xVxq6C1iRruOBGrRZmqLCKRtU1L xQ//Ly1A8qMJTOv3QlMJHjXvD8YB+/7olGEE72e/krbILDXlefCjDmIYFTTR8yX2n15J Ql/ZBKwQHPaXnBQR9CFciG28lFPPvF6BlL1o78YXTw1ex1yv2435j+hQOWGqckrrYWXK 98xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BHq3V6wgsHmxbKumrTk0927GbDnWp342NVcNICOr4+M=; b=fCuAr3bIEUMRFQX2acnqR1XKZ2OopCx4pjvexK6/Do9Wz9gCC0do6tZbAxMFBO8B7o ZDJ1YVHdM70tNgcC+TZXIas+iB3JVau3c+ZT7Z2o26o3hG8XoAeXFF8WRz1Pb+d8kU81 iihJnTKSh1zuWtj/rROxx77IX3IZIxWno3duNXWO/5/9k4MjimQlqBZr++Vt7OLlKXPR RmP/qANVRNE1C6uoegEg2pHVvQTwQqC8gxzWR1x1hmJvAYmJYvLf4g1CIEhr7tXbTJt1 ICPANU2mNpW0KcMe/4Q4PjmkrGNNKz4kD8KTas577yq3fCXqWYq7CPrmqVZGgmVV/wUR givg== X-Gm-Message-State: AKS2vOwbqO+NoiK3cGV39JuHHZo1r8f5vyMwczEenqrs7JVuSApbMkBC yMz8oU8twLAYkZsJNsU= X-Received: by 10.55.5.135 with SMTP id 129mr72239118qkf.184.1499482253421; Fri, 07 Jul 2017 19:50:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 16:50:28 -1000 Message-Id: <20170708025030.15845-2-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170708025030.15845-1-rth@twiddle.net> References: <20170708025030.15845-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH 1/3] tcg: Fix off-by-one in assert in page_set_flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net, riku.voipio@iki.fi, laurent@vivier.eu, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Most of the users of page_set_flags offset (page, page + len) as the end points. One might consider this an error, since the other users do supply an endpoint as the last byte of the region. However, the first thing that page_set_flags does is round end UP to the start of the next page. Which means computing page + len - 1 is in the end pointless. Therefore, accept this usage and do not assert when given the exact size of the vm as the endpoint. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index dfb9f0d..57578a4 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2068,7 +2068,7 @@ void page_set_flags(target_ulong start, target_ulong = end, int flags) guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ #if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS - assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); + assert(end <=3D ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); #endif assert(start < end); assert_memory_lock(); --=20 2.9.4