Anshuman Khandual
unread,Sep 6, 2026, 11:51:22 PM (4 days ago) Sep 6Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to linux-ar...@lists.infradead.org, Anshuman Khandual, Catalin Marinas, Will Deacon, Ryan Roberts, Mark Rutland, Lorenzo Stoakes, Andrew Morton, David Hildenbrand, Mike Rapoport, Linu Cherian, linux-...@vger.kernel.org, linu...@kvack.org, Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov, kasa...@googlegroups.com
D128 reduces the number of descriptors in each translation table, causing
some VA size and page granule combinations that use two page table levels
with D64 to now require three levels.
For three-level page tables, the PUD level is folded while the PMD level
remains a real translation level. Hence, PUD_SIZE represents a root-level
span. With D128, some configurations have a KASAN shadow region smaller
than this span, making it impossible for both KASAN shadow boundaries to
satisfy the existing PUD_SIZE alignment requirement.
The KASAN initialization code on arm64 already supports shadow boundaries
which are not root-level aligned, by installing or cloning the next-level
table as required.
Similarly for three level D128 page tables, relax SHADOW_ALIGN to PMD_SIZE,
which corresponds to the first non-folded level below the root level. Keep
the existing alignment requirements unchanged for all other configurations.
Cc: Andrey Ryabinin <
ryabin...@gmail.com>
Cc: Alexander Potapenko <
gli...@google.com>
Cc: Andrey Konovalov <
andre...@gmail.com>
Cc: Catalin Marinas <
catalin...@arm.com>
Cc: Will Deacon <
wi...@kernel.org>
Cc: Mark Rutland <
mark.r...@arm.com>
Cc:
kasa...@googlegroups.com
Cc:
linux-ar...@lists.infradead.org
Cc:
linux-...@vger.kernel.org
Signed-off-by: Anshuman Khandual <
anshuman...@arm.com>
---
arch/arm64/mm/kasan_init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index f61f5bc09467..e12abea6ad15 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -178,7 +178,9 @@ static void __init kasan_pgd_populate(unsigned long addr, unsigned long end,
} while (pgdp++, addr = next, addr != end);
}
-#if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS > 4
+#if defined(CONFIG_ARM64_D128) && CONFIG_PGTABLE_LEVELS == 3
+#define SHADOW_ALIGN PMD_SIZE
+#elif defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS > 4
#define SHADOW_ALIGN P4D_SIZE
#else
#define SHADOW_ALIGN PUD_SIZE
--
2.43.0