KVM: arm64: Release mmap_lock when using VM_SHARED with MTE
PATCH 1/1 KVM: arm64: Release mmap_lock when using VM_SHARED with MTE
VM_SHARED mappings are currently forbidden in a memslot with MTE to prevent two VMs racing to sanitise the same page. However, this check is performed while holding current->mm's mmap_lock, but fails to release it. Fix this by releasing the lock when needed.
Fixes ea7fc1bb1cd1 ("KVM: arm64: Introduce MTE VM feature")
Signed-off-by Quentin Perret <[email protected]>
--- arch/arm64/kvm/mmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kvm/mmu.c +4 -2
@@ -1529,8 +1529,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,* when updating the PG_mte_tagged page flag, see * sanitise_mte_tags for more details. */ -if (kvm_has_mte (kvm) && vma->vm_flags &VM_SHARED ) -return -EINVAL ; +if (kvm_has_mte (kvm) && vma->vm_flags &VM_SHARED ) { + ret = -EINVAL ; +break ; + }if (vma->vm_flags &VM_PFNMAP ) {/* IO region dirty page logging not allowed */
Signature · 1 line
2.33.0.800.g4c38ced690-goog
Quoted 4 lines · Quentin Perret
VM_SHAREDmappings are currently forbidden in a memslot with MTE to prevent two VMs racing to sanitise the same page. However, this check is performed while holding current->mm'smmap_lock, but fails to release it. Fix this by releasing the lock when needed.
Applied to fixes, thanks!
[1/1] KVM: arm64: Release mmap_lock when using VM_SHARED with MTE
commit: 6e6a8ef088e1222cb1250942f51ad9c1ab219ab2
Cheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.