Skip to content

RFC KVM: Introduce "VM bugged" concept

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

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: Export kvm_make_all_cpus_request() for use in marking VMs as buggedinclude/linux/kvm_host.h virt/kvm/kvm_main.c+10 -90 replies
2/3KVM: Add infrastructure and macro to mark VM as buggedinclude/linux/kvm_host.h virt/kvm/kvm_main.c+32 -50 replies
3/3KVM: x86: Use KVM_BUG/KVM_BUG_ON to handle bugs that are fatal to the VMarch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c+19 -107 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] KVM: Introduce "VM bugged" concept

This series introduces a concept we've discussed a few times in x86 land. The crux of the problem is that x86 has a few cases where KVM could theoretically encounter a software or hardware bug deep in a call stack without any sane way to propagate the error out to userspace.

Another use case would be for scenarios where letting the VM live will do more harm than good, e.g. we've been using KVM_BUG_ON for early TDX enabling as botching anything related to secure paging all but guarantees there will be a flood of WARNs and error messages because lower level PTE operations will fail if an upper level operation failed.

The basic idea is to WARN_ONCE if a bug is encountered, kick all vCPUs out to userspace, and mark the VM as bugged so that no ioctls() can be issued on the VM or its devices/vCPUs.

RFC as I've done nowhere near enough testing to verify that rejecting the ioctls(), evicting running vCPUs, etc... works as intended.

Sean Christopherson (3):
KVM: Export kvm_make_all_cpus_request() for use in marking VMs as
bugged
KVM: Add infrastructure and macro to mark VM as bugged
KVM: x86: Use KVM_BUG/KVM_BUG_ON to handle bugs that are fatal to the
VM

 arch/x86/kvm/svm/svm.c   |  2 +-
 arch/x86/kvm/vmx/vmx.c   | 23 ++++++++++++--------
 arch/x86/kvm/x86.c       |  4 ++++
 include/linux/kvm_host.h | 45 ++++++++++++++++++++++++++++++++--------
 virt/kvm/kvm_main.c      | 11 +++++-----
 5 files changed, 61 insertions(+), 24 deletions(-)
Signature · 1 line
2.28.0