[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-stable-commits
Subject:    patch kvm-mmu-fix-missing-locking-in-alloc_mmu_pages.patch added to 2.6.30-stable tree
From:       <gregkh () suse ! de>
Date:       2009-09-30 23:28:47
Message-ID: 20090930232912.6A0A34879C () coco ! kroah ! org
[Download RAW message or body]


This is a note to let you know that we have just queued up the patch titled

    Subject: KVM: MMU: fix missing locking in alloc_mmu_pages

to the 2.6.30-stable tree.  Its filename is

    kvm-mmu-fix-missing-locking-in-alloc_mmu_pages.patch

A git repo of this tree can be found at 
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary


From mtosatti@redhat.com  Wed Sep 30 16:22:02 2009
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Fri, 18 Sep 2009 20:08:03 -0300
Subject: KVM: MMU: fix missing locking in alloc_mmu_pages
To: stable@kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>, avi@redhat.com
Message-ID: <1253315287-12229-6-git-send-email-mtosatti@redhat.com>

From: Marcelo Tosatti <mtosatti@redhat.com>

(cherry picked from commit 6a1ac77110ee3e8d8dfdef8442f3b30b3d83e6a2)

n_requested_mmu_pages/n_free_mmu_pages are used by
kvm_mmu_change_mmu_pages to calculate the number of pages to zap.

alloc_mmu_pages, called from the vcpu initialization path, modifies this
variables without proper locking, which can result in a negative value
in kvm_mmu_change_mmu_pages (say, with cpu hotplug).

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 arch/x86/kvm/mmu.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2692,12 +2692,14 @@ static int alloc_mmu_pages(struct kvm_vc
 
 	ASSERT(vcpu);
 
+	spin_lock(&vcpu->kvm->mmu_lock);
 	if (vcpu->kvm->arch.n_requested_mmu_pages)
 		vcpu->kvm->arch.n_free_mmu_pages =
 					vcpu->kvm->arch.n_requested_mmu_pages;
 	else
 		vcpu->kvm->arch.n_free_mmu_pages =
 					vcpu->kvm->arch.n_alloc_mmu_pages;
+	spin_unlock(&vcpu->kvm->mmu_lock);
 	/*
 	 * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64.
 	 * Therefore we need to allocate shadow page tables in the first


Patches currently in stable-queue which might be from mtosatti@redhat.com are

queue-2.6.30/kvm-vmx-check-cpl-before-emulating-debug-register-access.patch
queue-2.6.30/kvm-vmx-fix-cr8-exiting-control-clobbering-by-ept.patch
queue-2.6.30/kvm-mmu-make-__kvm_mmu_free_some_pages-handle-empty-list.patch
queue-2.6.30/kvm-x86-disallow-hypercalls-for-guest-callers-in-rings-0.patch
queue-2.6.30/kvm-mmu-fix-missing-locking-in-alloc_mmu_pages.patch
queue-2.6.30/kvm-mmu-fix-bogus-alloc_mmu_pages-assignment.patch
queue-2.6.30/kvm-limit-lapic-periodic-timer-frequency.patch
queue-2.6.30/kvm-guest-fix-bogus-wallclock-physical-address-calculation.patch
queue-2.6.30/kvm-fix-cpuid-e2big-handling-for-extended-request-types.patch
queue-2.6.30/revert-kvm-x86-check-for-cr3-validity-in-ioctl_set_sregs.patch
--
To unsubscribe from this list: send the line "unsubscribe stable-commits" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic