1
0
Fork 0
alistair23-linux/arch/x86/kvm
Vitaly Kuznetsov d391f12070 x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested
I was investigating an issue with seabios >= 1.10 which stopped working
for nested KVM on Hyper-V. The problem appears to be in
handle_ept_violation() function: when we do fast mmio we need to skip
the instruction so we do kvm_skip_emulated_instruction(). This, however,
depends on VM_EXIT_INSTRUCTION_LEN field being set correctly in VMCS.
However, this is not the case.

Intel's manual doesn't mandate VM_EXIT_INSTRUCTION_LEN to be set when
EPT MISCONFIG occurs. While on real hardware it was observed to be set,
some hypervisors follow the spec and don't set it; we end up advancing
IP with some random value.

I checked with Microsoft and they confirmed they don't fill
VM_EXIT_INSTRUCTION_LEN on EPT MISCONFIG.

Fix the issue by doing instruction skip through emulator when running
nested.

Fixes: 68c3b4d167
Suggested-by: Radim Krčmář <rkrcmar@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
2018-01-31 18:25:34 +01:00
..
Kconfig KVM: x86: prefer "depends on" to "select" for SEV 2018-01-16 16:38:32 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpuid.c Merge branch 'sev-v9-p2' of https://github.com/codomania/kvm 2018-01-16 16:35:32 +01:00
cpuid.h KVM: x86: Fix CPUID function for word 6 (80000001_ECX) 2017-11-17 13:20:22 +01:00
debugfs.c kvm: x86: export TSC information to user-space 2016-09-16 16:57:48 +02:00
emulate.c KVM: x86: emulate RDPID 2017-12-14 09:26:40 +01:00
hyperv.c KVM: X86: implement the logic for spinlock optimization 2017-08-08 10:57:43 +02:00
hyperv.h kvm: x86: hyperv: make VP_INDEX managed by userspace 2017-07-14 16:28:18 +02:00
i8254.c KVM: x86: take slots_lock in kvm_free_pit 2017-07-12 22:38:26 +02:00
i8254.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i8259.c KVM: x86: simplify pic_ioport_read() 2017-04-12 20:17:15 +02:00
ioapic.c KVM: x86: ioapic: Preserve read-only values in the redirection table 2017-11-17 13:20:21 +01:00
ioapic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.c KVM: nVMX: Fix injection to L2 when L1 don't intercept external-interrupts 2018-01-16 16:40:09 +01:00
irq.h KVM: x86: don't hold kvm->lock in KVM_SET_GSI_ROUTING 2017-05-02 14:45:45 +02:00
irq_comm.c KVM: x86: don't hold kvm->lock in KVM_SET_GSI_ROUTING 2017-05-02 14:45:45 +02:00
kvm_cache_regs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lapic.c KVM: x86: Change __kvm_apic_update_irr() to also return if max IRR updated 2018-01-16 16:40:09 +01:00
lapic.h KVM: x86: Change __kvm_apic_update_irr() to also return if max IRR updated 2018-01-16 16:40:09 +01:00
mmu.c KVM: MMU: consider host cache mode in MMIO page check 2018-01-16 16:40:09 +01:00
mmu.h First batch of KVM changes for 4.15 2017-11-16 13:00:24 -08:00
mmu_audit.c KVM: x86: MMU: make array audit_point_name static 2017-12-14 09:26:41 +01:00
mmutrace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mtrr.c KVM: x86: generalize guest_cpuid_has_ helpers 2017-08-07 16:11:50 +02:00
page_track.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
paging_tmpl.h KVM: x86: extend usage of RET_MMIO_PF_* constants 2017-10-12 14:01:56 +02:00
pmu.c KVM: x86: never specify a sample period for virtualized in_tx_cp counters 2017-03-01 14:19:46 +01:00
pmu.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmu_amd.c perf/x86/amd: Make HW_CACHE_REFERENCES and HW_CACHE_MISSES measure L2 2016-09-16 16:19:49 +02:00
pmu_intel.c KVM: x86/vPMU: fix undefined shift in intel_pmu_refresh() 2017-05-19 19:59:27 +02:00
svm.c KVM: x86: Optimization: Create SVM stubs for sync_pir_to_irr() 2018-01-16 16:40:09 +01:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmx.c x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested 2018-01-31 18:25:34 +01:00
vmx_shadow_fields.h KVM: nVMX: track dirty state of non-shadowed VMCS fields 2018-01-16 16:50:13 +01:00
x86.c x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested 2018-01-31 18:25:34 +01:00
x86.h KVM: nVMX: Fix bug of injecting L2 exception into L1 2018-01-16 16:40:09 +01:00