Skip to content

Commit 188982c

Browse files
author
Marc Zyngier
committed
Merge branch kvm-arm64/mmu/mte into kvmarm-master/next
Last minute fix for MTE, making sure the pages are flagged as MTE before they are released. * kvm-arm64/mmu/mte: KVM: arm64: Set the MTE tag bit before releasing the page Signed-off-by: Marc Zyngier <maz@kernel.org>
2 parents 9f03db6 + 98db725 commit 188982c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

arch/arm64/kvm/guest.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,14 @@ long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm,
10531053
} else {
10541054
num_tags = mte_copy_tags_from_user(maddr, tags,
10551055
MTE_GRANULES_PER_PAGE);
1056+
1057+
/*
1058+
* Set the flag after checking the write
1059+
* completed fully
1060+
*/
1061+
if (num_tags == MTE_GRANULES_PER_PAGE)
1062+
set_bit(PG_mte_tagged, &page->flags);
1063+
10561064
kvm_release_pfn_dirty(pfn);
10571065
}
10581066

@@ -1061,10 +1069,6 @@ long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm,
10611069
goto out;
10621070
}
10631071

1064-
/* Set the flag after checking the write completed fully */
1065-
if (write)
1066-
set_bit(PG_mte_tagged, &page->flags);
1067-
10681072
gfn++;
10691073
tags += num_tags;
10701074
length -= PAGE_SIZE;

0 commit comments

Comments
 (0)