Subject: Re: [PATCH v2 4/5] KVM: arm64: Omit tag sync on stage-2 mappings of the zero page

From: Marc Zyngier <[email-masked]>
Date: Fri, 05 Jun 2026 17:18:30 +0100

On Thu, 04 Jun 2026 16:11:56 +0100,
Ard Biesheuvel <[email-masked]> wrote:
> 
> From: Ard Biesheuvel <[email-masked]>
> 
> Commit
> 
>    f620d66af316 ("arm64: mte: Do not flag the zero page as PG_mte_tagged")
> 
> removed the PG_mte_tagged flag from the zero page, but missed a KVM code
> path that may set this flag on the zero page when it is used in a
> stage-2 CoW mapping of anonymous memory.
> 
> So disregard the zero page explicitly in sanitise_mte_tags().
> 
> Fixes: f620d66af316 ("arm64: mte: Do not flag the zero page as PG_mte_tagged")
> Cc: <[email-masked]> # 5.10.x
> Suggested-by: Catalin Marinas <[email-masked]>
> Signed-off-by: Ard Biesheuvel <[email-masked]>
> ---
>  arch/arm64/kvm/mmu.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index d089c107d9b7..445d6cf035c9 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -1479,6 +1479,11 @@ static void sanitise_mte_tags(struct kvm *kvm, kvm_pfn_t pfn,
>  	if (!kvm_has_mte(kvm))
>  		return;
>  
> +	if (is_zero_pfn(pfn)) {
> +		WARN_ON_ONCE(nr_pages != 1);
> +		return;
> +	}
> +
>  	if (folio_test_hugetlb(folio)) {
>  		/* Hugetlb has MTE flags set on head page only */
>  		if (folio_try_hugetlb_mte_tagging(folio)) {

Reviewed-by: Marc Zyngier <[email-masked]>

	M.

-- 
Without deviation from the norm, progress is not possible.