Skip to content

Commit 6e6a8ef

Browse files
Quentin PerretMarc Zyngier
authored andcommitted
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: ea7fc1b ("KVM: arm64: Introduce MTE VM feature") Signed-off-by: Quentin Perret <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7615c2a commit 6e6a8ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arm64/kvm/mmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
15291529
* when updating the PG_mte_tagged page flag, see
15301530
* sanitise_mte_tags for more details.
15311531
*/
1532-
if (kvm_has_mte(kvm) && vma->vm_flags & VM_SHARED)
1533-
return -EINVAL;
1532+
if (kvm_has_mte(kvm) && vma->vm_flags & VM_SHARED) {
1533+
ret = -EINVAL;
1534+
break;
1535+
}
15341536

15351537
if (vma->vm_flags & VM_PFNMAP) {
15361538
/* IO region dirty page logging not allowed */

0 commit comments

Comments
 (0)