Skip to content

KVM: x86/mmu: Don't sync cached roots created for a different MMU context

Yosry Ahmed kvm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: x86/mmu: WARN, don't BUG, when walking a cached root with a PAE MMUarch/x86/kvm/mmu/mmu.c+8 -53 replies
2/4KVM: x86/mmu: Drop for_each_shadow_entry_using_root()arch/x86/kvm/mmu/mmu.c+2 -71 reply
3/4KVM: x86/mmu: Don't sync cached roots created for a different MMU contextarch/x86/kvm/mmu/mmu.c+46 -100 replies
4/4KVM: nVMX: Drop the TODO to sync only the affected SPTEs for INVVPIDarch/x86/kvm/vmx/nested.c+0 -20 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchJim Mattson
1/4
2/4R-b
3/4
4/4

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

Read the v1 thread

Cover letter [PATCH 0/4] KVM: x86/mmu: Don't sync cached roots created for a different MMU context

When invalidating an address, KVM walks and syncs cached roots using the current MMU context, but cached roots may have been created for a different context after a nested transition. With TDP disabled, this lets a guest trigger a BUG_ON() and crash the host (see patch 3 for details).

Patch 1 downgrades the BUG_ON() to a WARN_ON_ONCE(), patch 2 is prep work, patch 3 is the fix, and patch 4 drops a TODO that isn't worth pursuing.

Sashiko flagged the issue while reviewing the INVLPGA emulation patch in my nested SVM TLB series [1]. The host crash is easy to reproduce with an AI-generated repro (with TDP disabled), and no longer triggers with this series.

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

Yosry Ahmed (4):
KVM: x86/mmu: WARN, don't BUG, when walking a cached root with a PAE
MMU
KVM: x86/mmu: Drop for_each_shadow_entry_using_root()
KVM: x86/mmu: Don't sync cached roots created for a different MMU
context
KVM: nVMX: Drop the TODO to sync only the affected SPTEs for INVVPID

 arch/x86/kvm/mmu/mmu.c    | 76 ++++++++++++++++++++++++++++-----------
 arch/x86/kvm/vmx/nested.c |  2 --
 2 files changed, 55 insertions(+), 23 deletions(-)

base-commit: 6bd2905303c58679e303941b7d8ae8c074cd95ce

Signature · 1 line
2.56.0.385.gd3acb90ef8-goog