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

[XEN v2 10/11] xen/arm: Restrict zeroeth_table_offset for ARM_64


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Tue, 17 Jan 2023 17:43:57 +0000
  • 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=IUKkPNjs40zSymEmFxi8ADEbz2aWFS1vKYbBMcQpOKo=; b=efteD46leLWOXOsHEaPnwIF8mFD9+QdIkLMxKuZFOVc1jAvK4lytVYUuxLYoQ9TMRqvOo+qGKIGDXPYeZo3F9hO1eZ09Mkg9DwPi13/B5BC2NxjsYBTI+gTHhJYD8GkX9mLa3D9OeivWq/8Q5OSByGjEbhR7gBFg2gOvgHi47eXG3Md8zjT6dcpznKQ/iU6s1LIfz01lMxFhGBSQ1y4FV5s7afifAgdqsSUIqo/uCxEkVSjl0fKtlJ4yN8xWGgxLWlYO6vx6FckRRTP0e8ukIjZF197k91OS01rOdCg1g53WbJbocFfrrF503T2e3gTpinEjh1aoFEirpQyNN2wlfQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKX77pi5LhWWRRzUe8sPU9yYuuPG/bH5pkOAhg0ccaB0JRBzbH1dud0UiQ7M99W+wAjSnT9riXDwenhECcOai+QeLuZcimALY84XpMLhvEdVeKvncJPdsuwX1MeybWmLypFwpGDu6rXXbK9Ch1ALdFchv9dnM/f5eq3ZAi07kzgCKn4Dnfg6TkLw1L77Gsh4CTPbDefVVfUzUdprvhTAepLw06HyAgcgwWPd1OurJuWKVqkQBtOZMJOoeokSlSsg2IANRMjtoSM+WA2Je5Q4HtTIrF2KFHgENkUv6fjHSJEt+owzMT2vPWFEM0cXwHJeg6dIg5AC7EA1HBnrm+CJDw==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefano.stabellini@xxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Tue, 17 Jan 2023 17:57:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

zeroeth_table_offset is not accessed by ARM_32.
Also, when 32 bit physical addresses are used (ie ARM_PA_32=y), this
causes an overflow.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Changes from -

v1 - Removed the duplicate declaration for DECLARE_OFFSETS.

 xen/arch/arm/include/asm/lpae.h | 4 ++++
 xen/arch/arm/mm.c               | 7 +------
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/include/asm/lpae.h b/xen/arch/arm/include/asm/lpae.h
index 3fdd5d0de2..2744e0eebf 100644
--- a/xen/arch/arm/include/asm/lpae.h
+++ b/xen/arch/arm/include/asm/lpae.h
@@ -259,7 +259,11 @@ lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned int attr);
 #define first_table_offset(va)  TABLE_OFFSET(first_linear_offset(va))
 #define second_table_offset(va) TABLE_OFFSET(second_linear_offset(va))
 #define third_table_offset(va)  TABLE_OFFSET(third_linear_offset(va))
+#ifdef CONFIG_ARM_64
 #define zeroeth_table_offset(va)  TABLE_OFFSET(zeroeth_linear_offset(va))
+#else
+#define zeroeth_table_offset(va)  0
+#endif
 
 /*
  * Macros to define page-tables:
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index fab54618ab..95784e0c59 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -207,12 +207,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 {
     static const char *level_strs[4] = { "0TH", "1ST", "2ND", "3RD" };
     const mfn_t root_mfn = maddr_to_mfn(ttbr);
-    const unsigned int offsets[4] = {
-        zeroeth_table_offset(addr),
-        first_table_offset(addr),
-        second_table_offset(addr),
-        third_table_offset(addr)
-    };
+    DECLARE_OFFSETS(offsets, addr);
     lpae_t pte, *mapping;
     unsigned int level, root_table;
 
-- 
2.17.1




 


Rackspace

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