Skip to content

KVM: x86/mmu: Fix write-protection bug in the TDP MMU

David Matlack kvm stable 2 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 8 repliesApplied
  2. v12 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Skip setting the SPTE when MMU-writable is already clear [Sean]
- Add patches for {MMU,Host}-writable invariants [Sean]
- Fix inaccuracies in kvm_mmu_slot_remove_write_access() comment [Sean]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: x86/mmu: Fix write-protection of PTs mapped by the TDP MMUarch/x86/kvm/mmu/tdp_mmu.c+3 -31 reply
2/4KVM: x86/mmu: Clear MMU-writable during changed_pte notifierarch/x86/kvm/mmu/spte.c+1 -01 reply
3/4KVM: x86/mmu: Document and enforce MMU-writable and Host-writable invariantsarch/x86/kvm/mmu/spte.h+36 -62 replies
4/4KVM: x86/mmu: Improve TLB flush comment in kvm_mmu_slot_remove_write_access()arch/x86/kvm/mmu/mmu.c+22 -91 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchSean Christopherson
1/4R-b
2/4R-b
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] KVM: x86/mmu: Fix write-protection bug in the TDP MMU

While attempting to understand the big comment in kvm_mmu_slot_remove_write_access() about TLB flushing, I discovered a bug in the way the TDP MMU write-protects GFNs. I have not managed to reproduce the bug as it requires a rather complex set up of live migrating a VM that is using nested virtualization while the TDP MMU is enabled.

Patch 1 fixes the bug and is CC'd to stable.
Patch 2-3 fix, document, and enforce invariants around MMU-writable and Host-writable bits.
Patch 4 fixes up the aformentioned comment to be more readable.

Tested using the kvm-unit-tests and KVM selftests.

v2:
- Skip setting the SPTE when MMU-writable is already clear [Sean]
- Add patches for {MMU,Host}-writable invariants [Sean]
- Fix inaccuracies in kvm_mmu_slot_remove_write_access() comment [Sean]

v1: https://lore.kernel.org/kvm/[email protected]/

David Matlack (4):
KVM: x86/mmu: Fix write-protection of PTs mapped by the TDP MMU
KVM: x86/mmu: Clear MMU-writable during changed_pte notifier
KVM: x86/mmu: Document and enforce MMU-writable and Host-writable
invariants
KVM: x86/mmu: Improve TLB flush comment in
kvm_mmu_slot_remove_write_access()

 arch/x86/kvm/mmu/mmu.c     | 31 ++++++++++++++++++++--------
 arch/x86/kvm/mmu/spte.c    |  1 +
 arch/x86/kvm/mmu/spte.h    | 42 ++++++++++++++++++++++++++++++++------
 arch/x86/kvm/mmu/tdp_mmu.c |  6 +++---
 4 files changed, 62 insertions(+), 18 deletions(-)

base-commit: fea31d1690945e6dd6c3e89ec5591490857bc3d4

Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog