[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] xen/arm: guest_walk: refuse a block descriptor where the granule has none


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Fri, 6 Nov 2026 18:14:38 -0800
  • 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=YW0rX+bQbIc0bFUc3sRKftYB2+uxQbRjgb+eZ53kGK8=; b=UCHj+u4mM9vHBubMQeClDpOnPEw2o/aOUpNcE7I2yVlMC0K+qR28yPERgSR9w9sda1/nBT7vmJxnkbuoopSyu8bVTl0nbLBkuO5ZcvPSWZV9f9KVjHDE1K7De6g4NBpqORiVy2tYFNsjJZ+ONJ5nefwIcdMmG1H7pazIvCVb8mFWmNZ27DOYegMv/Jyk50aJ45Ch0exl1GJfDRDV4gGlZowHIk3DqcKj6Bxv7dc6vBXf5YWHpHvSZM0RrscEH+X/Ap+1ORTC6nQsmMcFfFkUnNEm3dJfFSCsbolOy9rKsSQC8n4pkUxN9jIe4hgjgpCQvIqLBNyyaKYbRg4uqJNo9g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZRYpL0Z9GyA9+2GxbKnx60Sw43iUYU+JH6W6Qn7acl4eV/aHzLFanqCOtcNTtUoVeQI7Q4pDDgwTbnvfvAL1xK23ohP/WailiXvgPt+95K/7VH/7Ey92mISsIPSE9rp7Z+BwKXtdhpkDr91pBMcakQ5rykx8oZ7K7Ox6dPFR9Ml2p0qUfMlf8ote6o8TT4LQ4Lz+KkSBeOEXzLRI6pjMvUbKm++4gWeb5TaO4B5wWhL38SId1cuoDxqkTNquqapr19fAfqoSzJ8qah8RTZqKkCGZrqs3ZOVbIi8o3SWp3jRFHyi2fegPApu0WMC6sXjFmW3iTCP+Ve/3smPOX6x13A==
  • 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: <stefano.stabellini@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Sat, 07 Nov 2026 02:15:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

guest_walk_ld() accepted a block descriptor at any level. No granule has
level 0 blocks, and the 16KB and 64KB granules have no level 1 blocks
(ARM DDI 0487A.k D4.3.1): the translation table walk makes such an entry
a Translation fault (AArch64.TranslationTableWalk(), J1.1.5). Refuse it.

Fixes: 7d623b358a45 ("arm/mem_access: Add long-descriptor based gpt")
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
Cc: Julien Grall <julien@xxxxxxx>
Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Cc: Michal Orzel <michal.orzel@xxxxxxx>
Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
---
 xen/arch/arm/guest_walk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index 09fe486598..e23457869b 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -533,6 +533,15 @@ static bool guest_walk_ld(const struct vcpu *v,
     if ( !lpae_is_valid(pte) || !lpae_is_mapping(pte, level) )
         return false;
 
+    /*
+     * A block descriptor is only supported at level 1 and level 2 with the
+     * 4KB granule, and only at level 2 with the 16KB and 64KB granules (ARM
+     * DDI 0487A.k D4.3.1). The block encoding at any other level generates a
+     * Translation fault (AArch64.TranslationTableWalk(), J1.1.5).
+     */
+    if ( level == 0 || (level == 1 && gran != GRANULE_SIZE_INDEX_4K) )
+        return false;
+
     /* Make sure that the lower bits of the PTE's base address are zero. */
     mask = GENMASK_ULL(47, grainsizes[gran]);
     *ipa = (pfn_to_paddr(pte.walk.base) & mask) |
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.