linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU
@ 2021-06-24  3:57 David Stevens
  2021-06-24  3:57 ` [PATCH 1/6] KVM: x86/mmu: release audited pfns David Stevens
                   ` (7 more replies)
  0 siblings, 8 replies; 34+ messages in thread
From: David Stevens @ 2021-06-24  3:57 UTC (permalink / raw)
  To: Marc Zyngier, Huacai Chen, Aleksandar Markovic, Paul Mackerras,
	Paolo Bonzini, Zhenyu Wang, Zhi Wang
  Cc: James Morse, Alexandru Elisei, Suzuki K Poulose, Will Deacon,
	Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, linux-arm-kernel, kvmarm, linux-kernel, linux-mips,
	kvm, kvm-ppc, linuxppc-dev, intel-gvt-dev, intel-gfx, dri-devel,
	David Stevens

KVM supports mapping VM_IO and VM_PFNMAP memory into the guest by using
follow_pte in gfn_to_pfn. However, the resolved pfns may not have
assoicated struct pages, so they should not be passed to pfn_to_page.
This series removes such calls from the x86 and arm64 secondary MMU. To
do this, this series modifies gfn_to_pfn to return a struct page in
addition to a pfn, if the hva was resolved by gup. This allows the
caller to call put_page only when necessated by gup.

This series provides a helper function that unwraps the new return type
of gfn_to_pfn to provide behavior identical to the old behavior. As I
have no hardware to test powerpc/mips changes, the function is used
there for minimally invasive changes. Additionally, as gfn_to_page and
gfn_to_pfn_cache are not integrated with mmu notifier, they cannot be
easily changed over to only use pfns.

This addresses CVE-2021-22543 on x86 and arm64.

David Stevens (6):
  KVM: x86/mmu: release audited pfns
  KVM: mmu: also return page from gfn_to_pfn
  KVM: x86/mmu: avoid struct page in MMU
  KVM: arm64/mmu: avoid struct page in MMU
  KVM: mmu: remove over-aggressive warnings
  drm/i915/gvt: use gfn_to_pfn's page instead of pfn

 arch/arm64/kvm/mmu.c                   |  42 +++++----
 arch/mips/kvm/mmu.c                    |   3 +-
 arch/powerpc/kvm/book3s.c              |   3 +-
 arch/powerpc/kvm/book3s_64_mmu_hv.c    |   5 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c |   5 +-
 arch/powerpc/kvm/book3s_hv_uvmem.c     |   4 +-
 arch/powerpc/kvm/e500_mmu_host.c       |   2 +-
 arch/x86/kvm/mmu/mmu.c                 |  60 ++++++------
 arch/x86/kvm/mmu/mmu_audit.c           |  13 ++-
 arch/x86/kvm/mmu/mmu_internal.h        |   3 +-
 arch/x86/kvm/mmu/paging_tmpl.h         |  36 +++++---
 arch/x86/kvm/mmu/tdp_mmu.c             |   7 +-
 arch/x86/kvm/mmu/tdp_mmu.h             |   4 +-
 arch/x86/kvm/x86.c                     |   9 +-
 drivers/gpu/drm/i915/gvt/gtt.c         |  12 ++-
 drivers/gpu/drm/i915/gvt/hypercall.h   |   3 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c       |  12 +--
 drivers/gpu/drm/i915/gvt/mpt.h         |   8 +-
 include/linux/kvm_host.h               |  27 ++++--
 include/linux/kvm_types.h              |   5 +
 virt/kvm/kvm_main.c                    | 123 +++++++++++++------------
 21 files changed, 212 insertions(+), 174 deletions(-)

-- 
2.32.0.93.g670b81a890-goog


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2021-06-25  7:45 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  3:57 [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU David Stevens
2021-06-24  3:57 ` [PATCH 1/6] KVM: x86/mmu: release audited pfns David Stevens
2021-06-24  8:43   ` Nicholas Piggin
2021-06-24  9:43     ` Paolo Bonzini
2021-06-24 15:36       ` Sean Christopherson
2021-06-24  3:57 ` [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn David Stevens
2021-06-24  8:52   ` Nicholas Piggin
2021-06-24  9:42     ` Paolo Bonzini
2021-06-24  9:57       ` Nicholas Piggin
2021-06-24 10:13         ` Paolo Bonzini
2021-06-24 10:17         ` Nicholas Piggin
2021-06-24 10:21           ` Paolo Bonzini
2021-06-24 10:42             ` Nicholas Piggin
2021-06-24  9:40   ` Marc Zyngier
2021-06-24  3:57 ` [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU David Stevens
2021-06-24  7:31   ` Paolo Bonzini
2021-06-24  8:58   ` Nicholas Piggin
2021-06-24 10:06     ` Marc Zyngier
2021-06-24 10:17       ` Paolo Bonzini
2021-06-24 10:43       ` Nicholas Piggin
2021-06-24  3:57 ` [PATCH 4/6] KVM: arm64/mmu: " David Stevens
2021-06-24 10:43   ` Marc Zyngier
2021-06-24  3:57 ` [PATCH 5/6] KVM: mmu: remove over-aggressive warnings David Stevens
2021-06-24  3:57 ` [PATCH 6/6] drm/i915/gvt: use gfn_to_pfn's page instead of pfn David Stevens
2021-06-24  4:28   ` David Stevens
2021-06-24  6:57 ` [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU Paolo Bonzini
2021-06-24 10:34 ` Nicholas Piggin
2021-06-24 11:42   ` Nicholas Piggin
2021-06-24 12:00     ` Paolo Bonzini
2021-06-24 12:41     ` Paolo Bonzini
2021-06-24 12:57       ` Nicholas Piggin
2021-06-24 15:35         ` Paolo Bonzini
2021-06-25  0:20           ` Nicholas Piggin
2021-06-25  7:44         ` Christian Borntraeger

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).