[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/arm: Fix under-mapping in map_range_to_domain()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Michal Orzel <michal.orzel@xxxxxxx>
- Date: Wed, 7 Oct 2026 15:58:48 +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 (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=AolQ6BjlzNs+PwrahIUve3U3eotV5pf1jtleJTOhi1M=; b=HcRHHVdruIg6aDWtKepMVLrZyNWKox17Tj2QWvfa3iRoOPX1p+gCcwayHcon7ha926He8+QUQHRSiQGdyqIzuaeXkZ43i9wxliUhK+F1kX/aH9klD7o0FPMbXmSdjpPG8RRGGV8+pdL+OHIWGeiqRVlmZNnIkfUYzzhJW2df9Ue7y6XwaOlhTYvCzlZtwE/5ADwB4aitKK9L+LtLGOoQMes4x4qr+yGQJta3dUKVZg2/2tlIxYyV3lquW6jjFASIhtLcm7trxdCbLhE588QG4KFhFy7fRXzGXeG/pKW3KEmPOD5mueSCvPqo2NiDP71+6Rt0lBXazOf6qztq0qVTug==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZSNXPvcOlfC0JIRANksZxO43kSQymnZtUyLFYnr22oyX5599yECAXBCj1/Kfq7NJ40nnwph/VM4GqeK19xTkZdsmAtbP306mLkgeJHYwZ8NFa/YgO5QX5f0jxp+EzxZcPTT/0asaVVz/DKNnRnUeFv6Bujl2Yl9ZuKR3WjtyjuseD1wLl1giC9NDgywPbfytWOHO6gPk1rNg4UEuV3I2smyl/fwAf/2EPYPc9u2axkWIjAYvfb4YFZ1Cvt2GEyv3uo26DnrKt7S/Tlq4Jhp9A/flBT5cZSvuo2XfNoOz/jstP14Ce02Uwr8AxF7AB1zemX9mrMnNZQ6jvIATYXRmBg==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- 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: Wed, 07 Oct 2026 13:59:11 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
If the memory region to be mapped does not start at the page boundary
and its end spans over the page boundary, map_range_to_domain() passes
a number of pages that is short by one to map_regions_p2mt(). Domain's
attempt to access memory within that page will fail. Fix it by calculating
the number of pages to be mapped taking into account the start offset.
Fixes: 88c10b0d6eee ("arch/arm: let map_mmio_regions() use start and count")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index b11366d722ef..ad50838b9f11 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -89,7 +89,7 @@ int __overlay_init map_range_to_domain(const struct
dt_device_node *dev,
{
res = map_regions_p2mt(d,
gaddr_to_gfn(addr),
- PFN_UP(len),
+ PFN_UP(addr + len) - PFN_DOWN(addr),
maddr_to_mfn(addr),
mr_data->p2mt);
--
2.43.0
|