Skip to content

Process some MMIO-related errors without KVM exit

Ivan Orlov kvm linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: vmx, svm, mmu: Fix MMIO during event delivery handlingarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/svm/svm.c +1 more+30 -140 replies
2/4KVM: x86: Inject UD when fetching from MMIOarch/x86/kvm/emulate.c arch/x86/kvm/kvm_emulate.h arch/x86/kvm/x86.c+10 -10 replies
3/4selftests: KVM: Change expected exit code in test_zero_memory_regionstools/testing/selftests/kvm/set_memory_region_test.c+2 -10 replies
4/4selftests: KVM: Add new test for faulty mmio usagetools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/x86_64/faulty_mmio.c+200 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/4] Process some MMIO-related errors without KVM exit

Currently, KVM may return a variety of internal errors to VMM when accessing MMIO, and some of them could be gracefully handled on the KVM level instead. Moreover, some of the MMIO-related errors are handled differently in VMX in comparison with SVM, which produces certain inconsistency and should be fixed. This patch series introduces KVM-level handling for the following situations:

1) Guest is accessing MMIO during event delivery: triple fault instead of internal error on VMX and infinite loop on SVM

2) Guest fetches an instruction from MMIO: inject #UD and resume guest execution without internal error

Additionaly, this patch series includes a KVM selftest which covers different cases of MMIO misuse.

Also, update the set_memory_region_test to expect the triple fault when starting VM with no RAM.

Ivan Orlov (4):
KVM: vmx, svm, mmu: Fix MMIO during event delivery handling
KVM: x86: Inject UD when fetching from MMIO
selftests: KVM: Change expected exit code in test_zero_memory_regions
selftests: KVM: Add new test for faulty mmio usage

 arch/x86/include/asm/kvm_host.h               |   6 +
 arch/x86/kvm/emulate.c                        |   3 +
 arch/x86/kvm/kvm_emulate.h                    |   1 +
 arch/x86/kvm/mmu/mmu.c                        |  13 +-
 arch/x86/kvm/svm/svm.c                        |   4 +
 arch/x86/kvm/vmx/vmx.c                        |  21 +-
 arch/x86/kvm/x86.c                            |   7 +-
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/set_memory_region_test.c    |   3 +-
 .../selftests/kvm/x86_64/faulty_mmio.c        | 199 ++++++++++++++++++
 10 files changed, 242 insertions(+), 16 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/faulty_mmio.c
Signature · 1 line
2.43.0