stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm" has been added to the 4.4-stable tree
@ 2017-04-09 19:25 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-04-09 19:25 UTC (permalink / raw)
  To: marc.zyngier, cdall, gregkh, suzuki.poulose; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-arm64-kvm-take-mmap_sem-in-stage2_unmap_vm.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 90f6e150e44a0dc3883110eeb3ab35d1be42b6bb Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 16 Mar 2017 18:20:49 +0000
Subject: arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm

From: Marc Zyngier <marc.zyngier@arm.com>

commit 90f6e150e44a0dc3883110eeb3ab35d1be42b6bb upstream.

We don't hold the mmap_sem while searching for the VMAs when
we try to unmap each memslot for a VM. Fix this properly to
avoid unexpected results.

Fixes: commit 957db105c997 ("arm/arm64: KVM: Introduce stage2_unmap_vm")
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/kvm/mmu.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -796,6 +796,7 @@ void stage2_unmap_vm(struct kvm *kvm)
 	int idx;
 
 	idx = srcu_read_lock(&kvm->srcu);
+	down_read(&current->mm->mmap_sem);
 	spin_lock(&kvm->mmu_lock);
 
 	slots = kvm_memslots(kvm);
@@ -803,6 +804,7 @@ void stage2_unmap_vm(struct kvm *kvm)
 		stage2_unmap_memslot(kvm, memslot);
 
 	spin_unlock(&kvm->mmu_lock);
+	up_read(&current->mm->mmap_sem);
 	srcu_read_unlock(&kvm->srcu, idx);
 }
 


Patches currently in stable-queue which might be from marc.zyngier@arm.com are

queue-4.4/arm-arm64-kvm-take-mmap_sem-in-kvm_arch_prepare_memory_region.patch
queue-4.4/arm-arm64-kvm-take-mmap_sem-in-stage2_unmap_vm.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-09 19:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-09 19:25 Patch "arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).