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

Ryan Roberts ryan.roberts at arm.com
Sat Nov 21 03:01:49 PST 2026


On 20/11/2026 12:16, Fuad Tabba wrote:
> 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")

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?

> Cc: stable at vger.kernel.org
> Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>
> --->  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();

I wonder if it would be clearer to wrap __set_ptes():

lazy_mmu_mode_pause()
__set_ptes()
lazy_mmu_mode_resume()

I notice that ptep_try_set() is also using emit_pte_barriers() directly, but
that feels like a layering violation to me.

Thanks,
Ryan


>  	} else {
>  		__pte_clear(&init_mm, addr, ptep);
>  		flush_tlb_kernel_range(addr, addr+PAGE_SIZE);




More information about the linux-arm-kernel mailing list