]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Set the MTE tag bit before releasing the page
authorMarc Zyngier <maz@kernel.org>
Thu, 24 Jun 2021 13:21:05 +0000 (14:21 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 24 Jun 2021 13:54:45 +0000 (14:54 +0100)
commitc8236f9ba98db3cc437a75d1037a005018ff918f
tree716432fd9008d5731c96be932db5af0bdb4b524e
parent1ce2b5b561d8f2a8207b6b1246eec316b42f1c16
KVM: arm64: Set the MTE tag bit before releasing the page

Setting a page flag without holding a reference to the page
is living dangerously. In the tag-writing path, we drop the
reference to the page by calling kvm_release_pfn_dirty(),
and only then set the PG_mte_tagged bit.

It would be safer to do it the other way round.

Fixes: 0b053623cad6f ("KVM: arm64: Add ioctl to fetch/store tags in a guest")
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/87k0mjidwb.wl-maz@kernel.org
arch/arm64/kvm/guest.c