From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Ryan Roberts <ryan.roberts@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Lorenzo Stoakes <ljs@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Linu Cherian <linu.cherian@arm.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
kasan-dev@googlegroups.com
Subject: [PATCH V2 12/14] arm64/mm: Relax KASAN shadow alignment for FEAT_D128
Date: Mon, 7 Sep 2026 09:20:27 +0530 [thread overview]
Message-ID: <20260907035030.2839978-13-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20260907035030.2839978-1-anshuman.khandual@arm.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 <ryabinin.a.a@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: kasan-dev@googlegroups.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@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
next prev parent reply other threads:[~2026-09-07 3:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 3:50 [PATCH V2 00/14] arm64/mm: Enable 128 bit page table entries Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 01/14] mm: Add read-write accessors for vm_page_prot Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 02/14] arm64/mm: Route all pgtable reads via ptval_get() Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 03/14] arm64/mm: Route all pgtable writes via ptval_set() Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 04/14] arm64/mm: Route all pgtable atomics to central helpers Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 05/14] arm64/mm: Override read-write accessors for vm_page_prot Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 06/14] arm64/mm: Enable fixmap with 5 level page table Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 07/14] arm64/mm: Enable pgtable geometry for FEAT_D128 Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 08/14] arm64/mm: Enable pgtable descriptor " Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 09/14] arm64/mm: Enable 128 bit translation Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 10/14] arm64/mm: Add an abstraction level for tlbi_op Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 11/14] arm64/mm: Enable TLBIP instruction based TLB flush Anshuman Khandual
2026-09-07 3:50 ` Anshuman Khandual [this message]
2026-09-07 3:50 ` [PATCH V2 13/14] arm64/mm: Make ARM64_D128 selectable Anshuman Khandual
2026-09-07 3:50 ` [PATCH V2 14/14] arm64/configs: Add d128.config Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260907035030.2839978-13-anshuman.khandual@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linu.cherian@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mark.rutland@arm.com \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox