[PATCH 3/3] arm64: mm: Don't defer the barriers when installing a fixmap entry

From: Fuad Tabba

Date: Fri Nov 20 2026 - 07:17:00 EST


In lazy MMU mode, __set_pte(), which __set_fixmap() uses, only queues
its DSB and ISB, but a caller can dereference the slot as soon as
__set_fixmap() returns. On a CPU with BBML3, runtime changes to the
linear map are made in lazy MMU mode. With 4K pages and 39-bit VAs, for
example, such a change can update a top-level entry, which
set_swapper_pgd() writes through FIX_PGD. That store can fault, and the
kernel then warns about a spurious translation fault. When kgdb stops a
CPU in lazy MMU mode, its breakpoint writes through FIX_TEXT_POKE0 can
fault the same way, and fail.

Emit the barriers directly in __set_fixmap().

Fixes: 5fdd05efa1cd3 ("arm64/mm: Batch barriers when updating kernel mappings")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
arch/arm64/mm/fixmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c
index f66a0016dd02d..951004ad700c3 100644
--- a/arch/arm64/mm/fixmap.c
+++ b/arch/arm64/mm/fixmap.c
@@ -127,7 +127,9 @@ void __set_fixmap(enum fixed_addresses idx,
ptep = fixmap_pte(addr);

if (pgprot_val(flags)) {
- __set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, flags));
+ /* The slot must be usable on return, even in lazy MMU mode. */
+ __set_pte_nosync(ptep, pfn_pte(phys >> PAGE_SHIFT, flags));
+ emit_pte_barriers();
} else {
__pte_clear(&init_mm, addr, ptep);
flush_tlb_kernel_range(addr, addr+PAGE_SIZE);
--
2.47.3