From: Ryan Roberts <ryan.roberts@arm.com>
To: Fuad Tabba <fuad.tabba@linux.dev>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Ard Biesheuvel <ardb@kernel.org>,
Yang Shi <yang@os.amperecomputing.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Fuad Tabba <tabba@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 3/3] arm64: mm: Don't defer the barriers when installing a fixmap entry
Date: Sat, 21 Nov 2026 11:01:49 +0000 [thread overview]
Message-ID: <6782b5ee-3dfe-4076-a79c-fbeb2c2ac7da@arm.com> (raw)
In-Reply-To: <20261120121638.194154-4-fuad.tabba@linux.dev>
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@vger.kernel.org
> Signed-off-by: Fuad Tabba <fuad.tabba@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);
prev parent reply other threads:[~2026-11-21 11:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 12:16 [PATCH 0/3] arm64: Missing barriers in kernel page-table updates Fuad Tabba
2026-11-20 12:16 ` [PATCH 1/3] arm64: pi: Add an ISB after mapping the FDT in the initial ID map Fuad Tabba
2026-11-21 10:42 ` Ryan Roberts
2026-11-20 12:16 ` [PATCH 2/3] arm64: mm: Add an ISB after remapping the KPTI page-table slot Fuad Tabba
2026-11-21 10:48 ` Ryan Roberts
2026-11-20 12:16 ` [PATCH 3/3] arm64: mm: Don't defer the barriers when installing a fixmap entry Fuad Tabba
2026-11-21 11:01 ` Ryan Roberts [this message]
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=6782b5ee-3dfe-4076-a79c-fbeb2c2ac7da@arm.com \
--to=ryan.roberts@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=stable@vger.kernel.org \
--cc=tabba@google.com \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
/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
all inboxes | Powered by JetHome®