Skip to content

KVM: Drop vm_dead, pivot on vm_bugged for -EIO

Sean Christopherson kvm kvmarm linux-arm-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: Never clear KVM_REQ_VM_DEAD from a vCPU's requestsarch/arm64/kvm/arm.c arch/x86/kvm/mmu/mmu.c arch/x86/kvm/vmx/tdx.c +2 more+11 -60 replies
2/5KVM: TDX: Exit with MEMORY_FAULT on unexpected pending S-EPT Violationarch/x86/kvm/vmx/tdx.c+2 -410 replies
3/5KVM: Reject ioctls only if the VM is bugged, not simply marked deadarch/arm64/kvm/vgic/vgic-init.c include/linux/kvm_host.h tools/testing/selftests/kvm/x86/sev_migrate_tests.c +1 more+7 -121 reply
4/5KVM: selftests: Use for-loop to handle all successful SEV migrationstools/testing/selftests/kvm/x86/sev_migrate_tests.c+14 -170 replies
5/5KVM: TDX: Add sub-ioctl KVM_TDX_TERMINATE_VMDocumentation/virt/kvm/x86/intel-tdx.rst arch/x86/include/uapi/asm/kvm.h arch/x86/kvm/vmx/tdx.c +1 more+57 -104 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchVishal AnnapurveXiaoyao LiRick Edgecombe
1/5
2/5R-b
3/5
4/5
5/5A-b T-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] KVM: Drop vm_dead, pivot on vm_bugged for -EIO

Drop vm_dead and instead reject ioctls based only on vm_bugged. Checking vm_dead (or vm_bugged) is inherently racy due as it's not protected by any locks. For vm_bugged, imperfection is a-ok as the goal is purely to limit the damage done by a kernel/hardware bug. But rejecting ioclts based on vm_dead is dangerous as it gives us a false sense of security, e.g. see the race found by syzbot in commit ecf371f8b02d ("KVM: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight").

This series was motivated by the last patch, a.k.a. KVM_TDX_TERMINATE_VM. I applied a slightly different version of that patch for 6.17[*], but I'm reposting it with the vm_dead changes due to Paolo's question about whether or not we should have a generic KVM_TERMINATE_VM; dropping vm_dead doesn't make much sense if we want to add KVM_TERMINATE_VM.

[*] https://lore.kernel.org/all/[email protected]

Sean Christopherson (5):
KVM: Never clear KVM_REQ_VM_DEAD from a vCPU's requests
KVM: TDX: Exit with MEMORY_FAULT on unexpected pending S-EPT Violation
KVM: Reject ioctls only if the VM is bugged, not simply marked dead
KVM: selftests: Use for-loop to handle all successful SEV migrations
KVM: TDX: Add sub-ioctl KVM_TDX_TERMINATE_VM

 Documentation/virt/kvm/x86/intel-tdx.rst      | 22 ++++++++-
 arch/arm64/kvm/arm.c                          |  2 +-
 arch/arm64/kvm/vgic/vgic-init.c               |  2 +-
 arch/x86/include/uapi/asm/kvm.h               |  7 ++-
 arch/x86/kvm/mmu/mmu.c                        |  2 +-
 arch/x86/kvm/vmx/tdx.c                        | 45 +++++++++++++------
 arch/x86/kvm/vmx/tdx.h                        |  1 +
 arch/x86/kvm/x86.c                            |  2 +-
 include/linux/kvm_host.h                      | 11 +++--
 .../selftests/kvm/x86/sev_migrate_tests.c     | 34 ++++++--------
 virt/kvm/kvm_main.c                           | 10 ++---
 11 files changed, 90 insertions(+), 48 deletions(-)

base-commit: beafd7ecf2255e8b62a42dc04f54843033db3d24

Signature · 1 line
2.50.1.552.g942d659e1b-goog