alistair23-linux/arch/x86/kvm
Sheng Yang 571008dacc KVM: x86 emulator: Only allow VMCALL/VMMCALL trapped by #UD
When executing a test program called "crashme", we found the KVM guest cannot
survive more than ten seconds, then encounterd kernel panic. The basic concept
of "crashme" is generating random assembly code and trying to execute it.

After some fixes on emulator insn validity judgment, we found it's hard to
get the current emulator handle the invalid instructions correctly, for the
#UD trap for hypercall patching caused troubles. The problem is, if the opcode
itself was OK, but combination of opcode and modrm_reg was invalid, and one
operand of the opcode was memory (SrcMem or DstMem), the emulator will fetch
the memory operand first rather than checking the validity, and may encounter
an error there. For example, ".byte 0xfe, 0x34, 0xcd" has this problem.

In the patch, we simply check that if the invalid opcode wasn't vmcall/vmmcall,
then return from emulate_instruction() and inject a #UD to guest. With the
patch, the guest had been running for more than 12 hours.

Signed-off-by: Feng (Eric) Liu <eric.e.liu@intel.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30 18:01:21 +02:00
..
i8259.c
irq.c KVM: Move kvm_vcpu_kick() to x86.c 2008-01-30 18:01:19 +02:00
irq.h KVM: Move kvm_vcpu_kick() to x86.c 2008-01-30 18:01:19 +02:00
Kconfig
kvm_svm.h
lapic.c KVM: Accelerated apic support 2008-01-30 18:01:20 +02:00
lapic.h KVM: Accelerated apic support 2008-01-30 18:01:20 +02:00
Makefile KVM: Move ioapic code to common directory. 2008-01-30 18:01:19 +02:00
mmu.c KVM: MMU: Move kvm_free_some_pages() into critical section 2008-01-30 18:01:21 +02:00
mmu.h
paging_tmpl.h KVM: MMU: Merge shadow level check in FNAME(fetch) 2008-01-30 18:01:21 +02:00
segment_descriptor.h
svm.c KVM: x86 emulator: Only allow VMCALL/VMMCALL trapped by #UD 2008-01-30 18:01:21 +02:00
svm.h
vmx.c KVM: x86 emulator: Only allow VMCALL/VMMCALL trapped by #UD 2008-01-30 18:01:21 +02:00
vmx.h
x86.c KVM: x86 emulator: Only allow VMCALL/VMMCALL trapped by #UD 2008-01-30 18:01:21 +02:00
x86_emulate.c