From nobody Thu Apr 25 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1557836774; cv=none; d=zoho.com; s=zohoarc; b=c1LZqDOLk7Ss/sG8QyXVWbzlDBjx28hZZSPDITOOfY9JVLBl6uyp4UfxgW1VW/jkY+DK/DrI3wFXhb5iO1ag/Fps1jdey5Ltq12ErR7hbCGBIUK72rGLhL92rCXINLNBud3gid/DJ2gZWYlcREHg8DgNVaJ6bF63/4lR+U3IQpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836774; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Py+BjY5hw5qju9cux+1+KLgu52CoNyXrmrwH3H0tjNE=; b=jbcprUOiWZl6d5Ph89zdP6JKdHMMKQpbBvhY3Bq6rjSVt/Kp9MveIEDYnyldsR7JnZDxICTLeaGdM3UKZrCScm3/nt9zacxPGq6lGhi8g7rXCACOPTV+tLF3xPV90BGZc/I9voTvb1PvIqJEBvavSahIwin5BhhzKBwA+omZGI0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 155783677447740.60011009116624; Tue, 14 May 2019 05:26:14 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hQWUu-00034t-0n; Tue, 14 May 2019 12:25:32 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hQWUs-00031z-Li for xen-devel@lists.xenproject.org; Tue, 14 May 2019 12:25:30 +0000 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 5befe1c5-7643-11e9-8980-bc764e045a96; Tue, 14 May 2019 12:25:28 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2A60341; Tue, 14 May 2019 05:25:28 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F48F3F71E; Tue, 14 May 2019 05:25:27 -0700 (PDT) X-Inumbo-ID: 5befe1c5-7643-11e9-8980-bc764e045a96 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 14 May 2019 13:24:55 +0100 Message-Id: <20190514122456.28559-19-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190514122456.28559-1-julien.grall@arm.com> References: <20190514122456.28559-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH MM-PART2 RESEND v2 18/19] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr_Tyshchenko@epam.com, Julien Grall , Stefano Stabellini , Andrii Anisov MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The two helpers {destroy, modify}_xen_mappings don't check that the start is always before the end. This should never happen but if it happens, it will result to unexpected behavior. Catch such issues earlier on by adding an ASSERT in destroy_xen_mappings and modify_xen_mappings. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov Acked-by: Stefano Stabellini --- Changes in v2: - Add Andrii's reviewed-by --- xen/arch/arm/mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index eacc1647e0..b408de7c75 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1077,11 +1077,13 @@ int populate_pt_range(unsigned long virt, unsigned = long nr_mfns) =20 int destroy_xen_mappings(unsigned long v, unsigned long e) { + ASSERT(v <=3D e); return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIF= T, 0); } =20 int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int fla= gs) { + ASSERT(s <=3D e); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIF= T, flags); } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel