[PATCH 1/2] arm64: mm: Mask the TLBI operand in kpti_map_pgtbl()

Fuad Tabba fuad.tabba at linux.dev
Thu Dec 3 05:25:16 PST 2026


kpti_map_pgtbl(), added by commit 47546a1912fc4 ("arm64: mm: install
KPTI nG mappings with MMU enabled"), maps each page-table page at a
fixed address near the top of the address space, after invalidating the
address with TLBI VAAE1.

The operand is the address shifted right by 12, so its upper bits end
up in the TTL field as a hint for a 64K level 3 entry. On a 4K or 16K
kernel the hint is wrong, and a CPU with FEAT_TTL isn't required to
invalidate the old translation. idmap_kpti_install_ng_mappings() can
then read the previous table through it instead of the next one, whose
mappings stay global with KPTI enabled.

Mask the operand down to VA[55:12], matching __TLBI_VADDR().

Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>
---
 arch/arm64/mm/proc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 12aacc74f7647..e122622838ff3 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -252,7 +252,7 @@ SYM_FUNC_ALIAS(__pi_idmap_cpu_replace_ttbr1, idmap_cpu_replace_ttbr1)
 	str	xzr, [temp_pte, #8 * (\level + 2)]	// break before make
 	dsb	nshst
 	add	pte, temp_pte, #PAGE_SIZE * (\level + 2)
-	lsr	pte, pte, #12
+	ubfx	pte, pte, #12, #44
 	tlbi	vaae1, pte
 	dsb	nsh
 	isb
-- 
2.47.3




More information about the linux-arm-kernel mailing list