linux_dsm_epyc7002/arch/x86/kvm
Dmitry Vyukov ce2e852ecc KVM: x86: fix fixing of hypercalls
emulator_fix_hypercall() replaces hypercall with vmcall instruction,
but it does not handle GP exception properly when writes the new instruction.
It can return X86EMUL_PROPAGATE_FAULT without setting exception information.
This leads to incorrect emulation and triggers
WARN_ON(ctxt->exception.vector > 0x1f) in x86_emulate_insn()
as discovered by syzkaller fuzzer:

WARNING: CPU: 2 PID: 18646 at arch/x86/kvm/emulate.c:5558
Call Trace:
 warn_slowpath_null+0x2c/0x40 kernel/panic.c:582
 x86_emulate_insn+0x16a5/0x4090 arch/x86/kvm/emulate.c:5572
 x86_emulate_instruction+0x403/0x1cc0 arch/x86/kvm/x86.c:5618
 emulate_instruction arch/x86/include/asm/kvm_host.h:1127 [inline]
 handle_exception+0x594/0xfd0 arch/x86/kvm/vmx.c:5762
 vmx_handle_exit+0x2b7/0x38b0 arch/x86/kvm/vmx.c:8625
 vcpu_enter_guest arch/x86/kvm/x86.c:6888 [inline]
 vcpu_run arch/x86/kvm/x86.c:6947 [inline]

Set exception information when write in emulator_fix_hypercall() fails.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: kvm@vger.kernel.org
Cc: syzkaller@googlegroups.com
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
2017-01-17 15:06:05 +01:00
..
assigned-dev.c
assigned-dev.h
cpuid.c KVM: x86: Expose Intel AVX512IFMA/AVX512VBMI/SHA features to guest. 2016-12-15 15:02:44 +01:00
cpuid.h
debugfs.c kvm: x86: export TSC information to user-space 2016-09-16 16:57:48 +02:00
emulate.c KVM: x86: fix emulation of "MOV SS, null selector" 2017-01-12 15:17:13 +01:00
hyperv.c KVM: hyperv: fix locking of struct kvm_hv fields 2016-12-16 17:53:38 +01:00
hyperv.h KVM: x86: Hyper-V tsc page setup 2016-09-20 09:26:20 +02:00
i8254.c KVM: x86: Handle the kthread worker using the new API 2016-12-08 15:31:11 +01:00
i8254.h KVM: x86: Handle the kthread worker using the new API 2016-12-08 15:31:11 +01:00
i8259.c
ioapic.c KVM: x86: fix out-of-bounds accesses of rtc_eoi map 2016-11-24 18:37:19 +01:00
ioapic.h KVM: x86: fix out-of-bounds accesses of rtc_eoi map 2016-11-24 18:37:19 +01:00
iommu.c
irq_comm.c KVM: x86: check for pic and ioapic presence before use 2016-11-24 18:39:28 +01:00
irq.c
irq.h
Kconfig
kvm_cache_regs.h
lapic.c KVM: x86: flush pending lapic jump label updates on module unload 2017-01-12 14:33:17 +01:00
lapic.h KVM: x86: flush pending lapic jump label updates on module unload 2017-01-12 14:33:17 +01:00
Makefile kvm: add stubs for arch specific debugfs support 2016-09-16 16:57:47 +02:00
mmu_audit.c
mmu.c kvm: svm: Add support for additional SVM NPF error codes 2016-11-24 18:32:26 +01:00
mmu.h
mmutrace.h
mtrr.c
page_track.c kvm/page_track: export symbols for external usage 2016-11-04 12:13:20 +01:00
paging_tmpl.h
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
pmu.c
pmu.h
svm.c KVM: x86: Add kvm_skip_emulated_instruction and use it. 2016-12-08 15:31:05 +01:00
trace.h
tss.h
vmx.c KVM: VMX: remove duplicated declaration 2017-01-05 15:08:48 +01:00
x86.c KVM: x86: fix fixing of hypercalls 2017-01-17 15:06:05 +01:00
x86.h KVM: x86: introduce get_kvmclock_ns 2016-09-20 09:26:15 +02:00