aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2012-04-11 11:51:49 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-05-25 12:24:32 -0400
commit2864b16894a2413e3f425b99d41fd7bb2bec58af (patch)
tree2bfd740c43b0d70dc58fc0137f83e7799c746359 /include/linux
parenteecd5b0c1f0728c3455ec260e92502cef95bf70a (diff)
KVM: unmap pages from the iommu when slots are removed
BugLink: http://bugs.launchpad.net/bugs/987569 CVE-2012-2121 We've been adding new mappings, but not destroying old mappings. This can lead to a page leak as pages are pinned using get_user_pages, but only unpinned with put_page if they still exist in the memslots list on vm shutdown. A memslot that is destroyed while an iommu domain is enabled for the guest will therefore result in an elevated page reference count that is never cleared. Additionally, without this fix, the iommu is only programmed with the first translation for a gpa. This can result in peer-to-peer errors if a mapping is destroyed and replaced by a new mapping at the same gpa as the iommu will still be pointing to the original, pinned memory address. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> (cherry picked from commit 32f6daad4651a748a58a3ab6da0611862175722f) Conflicts: virt/kvm/iommu.c Signed-off-by: Steve Conklin <sconklin@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kvm_host.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d70a250701e..8663a267ae3 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -554,6 +554,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
554 554
555#ifdef CONFIG_IOMMU_API 555#ifdef CONFIG_IOMMU_API
556int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 556int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
557void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
557int kvm_iommu_map_guest(struct kvm *kvm); 558int kvm_iommu_map_guest(struct kvm *kvm);
558int kvm_iommu_unmap_guest(struct kvm *kvm); 559int kvm_iommu_unmap_guest(struct kvm *kvm);
559int kvm_assign_device(struct kvm *kvm, 560int kvm_assign_device(struct kvm *kvm,
@@ -567,6 +568,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
567 return 0; 568 return 0;
568} 569}
569 570
571static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
572 struct kvm_memory_slot *slot)
573{
574}
575
570static inline int kvm_iommu_map_guest(struct kvm *kvm) 576static inline int kvm_iommu_map_guest(struct kvm *kvm)
571{ 577{
572 return -ENODEV; 578 return -ENODEV;