[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/arm: Handle empty grant table region in find_unallocated_memory()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Michal Orzel <michal.orzel@xxxxxxx>
- Date: Thu, 24 Aug 2023 11:06:40 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5oa2P7g2Yo5D+ZwtVfauh4e9cq1iHtWwSzAl2ftEMU0=; b=glr4YJPmxrRfiYakbwtQpcg+S9ZkNYwFw56LThF5JSspNFh9zo7c8MHHjLum0Iuf4gYMcs6E3GFqJJSXxr4uSPc0QhtP5fA7JdOuJ3mcQHzdvr/62loWd/Yy0fyzFxUhnDzb+eaTBzzCDaLUBHfz61ox6+rveWWsX1NiaNjUIxenmF8bqXjbPlAOjHFYICFUqTCGdAPscPdVcpI4Z4GVZhd2wWhJIGRRRSduFJbjaUMaYGhDPLAoA7co9bcpwgHHDoBHCJ0ntim4YTJeh2mBnmnD0Y+fou35lTOIU+ExUqffMZkiYD4g33yvPsWTh3+/a/SaZJk60CIQZpLJRHMNhA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hGeFD8Dle0NQkTNQxFoVh3VEY+g00ZyYujpzyOTC6azSDDO7XkkpOwhTGYnE/Nw74WhlVRXWrHlpDU8ydAiZX579T3/6GfwHrl8EUUm6NXP1yja2O7B1UyQplvJj7qPAkEiXMEx3JUMQzUDU4gBmvkL1pLSRuD+brQoitxzQQT7rcIJQuVLzRrFcVszWN2ic9WdpZbhpRasGJEByACsb/INQ3Xr2uw3jCybYExuNqq0pGdp5PE8VffOQnOmCD3x+EENB6f0dryp6tjYTmK6j3ZwhGEuvtTtH1p0nGrX/Ivv+jVh8GMkbUmd3lq7obgyoDoECuotaIn+oE7xdlxE4hA==
- Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Thu, 24 Aug 2023 09:06:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
When creating dom0 with grant table support disabled in Xen and no IOMMU,
the following assert is triggered (debug build):
"Assertion 's <= e' failed at common/rangeset.c:189"
This is because find_unallocated_memory() (used to find memory holes
for extended regions) calls rangeset_remove_range() for an empty
grant table region. Fix it by checking if the size of region is not 0.
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/domain_build.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 54bf5623c889..2e899458acdf 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1633,14 +1633,18 @@ static int __init find_unallocated_memory(const struct
kernel_info *kinfo,
}
/* Remove grant table region */
- start = kinfo->gnttab_start;
- end = kinfo->gnttab_start + kinfo->gnttab_size;
- res = rangeset_remove_range(unalloc_mem, PFN_DOWN(start), PFN_DOWN(end -
1));
- if ( res )
+ if ( kinfo->gnttab_size )
{
- printk(XENLOG_ERR "Failed to remove: %#"PRIpaddr"->%#"PRIpaddr"\n",
- start, end);
- goto out;
+ start = kinfo->gnttab_start;
+ end = kinfo->gnttab_start + kinfo->gnttab_size;
+ res = rangeset_remove_range(unalloc_mem, PFN_DOWN(start),
+ PFN_DOWN(end - 1));
+ if ( res )
+ {
+ printk(XENLOG_ERR "Failed to remove: %#"PRIpaddr"->%#"PRIpaddr"\n",
+ start, end);
+ goto out;
+ }
}
start = 0;
--
2.25.1
|