Re: [PATCH 3/3] arm64: mm: Don't defer the barriers when installing a fixmap entry
From: Fuad Tabba
Date: Mon Nov 23 2026 - 02:36:16 EST
Hi Ryan,
On Sat, 21 Nov 2026 11:01:49 +0000, Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
[...]
> > 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")
>
> My memory might be betraying me, but I think this change went in before BBML3
> (BBML2_NOABORT)? In which case, the bug is only exposed by the latter series?
It did, and the set_swapper_pgd() path is only exposed by the later
series. The tag is for the kgdb path, which doesn't depend on BBML3.
When kgdb is entered from a breakpoint in process context,
in_interrupt() is false, so in lazy MMU mode the barriers for its
FIX_TEXT_POKE0 mapping are still deferred.
[...]
> > diff --git 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();
>
> I wonder if it would be clearer to wrap __set_ptes():
>
> lazy_mmu_mode_pause()
> __set_ptes()
> lazy_mmu_mode_resume()
That would work. However, there's the stable backport. 6.18 has the
bug, but lazy_mmu_mode_pause() was added in 7.0, so 6.18.y would need
its own patch. This patch applies to 6.18 unchanged.
I'm happy with either, or with a followup patch in the same series.
Cheers,
/fuad