summaryrefslogtreecommitdiff
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-02-18 12:14:59 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-15 08:50:15 -0700
commit3e338f53281fc492a931928e6e53ec15eaf9cf3d (patch)
treedbf5bf84421f7b1e4338017879ce82fb7671452b /arch/x86/kvm
parent89412b0b75eab56d30a2592bb8fd3d8f68825803 (diff)
KVM: x86 emulator: Forbid modifying CS segment register by mov instruction
commit 8b9f44140bc4afd2698413cd9960c3912168ee91 upstream. Inject #UD if guest attempts to do so. This is in accordance to Intel SDM. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/emulate.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5ca9556f221e..e9604420b778 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1875,6 +1875,12 @@ special_insn:
int err;
sel = c->src.val;
+
+ if (c->modrm_reg == VCPU_SREG_CS) {
+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR);
+ goto done;
+ }
+
if (c->modrm_reg == VCPU_SREG_SS)
toggle_interruptibility(ctxt, X86_SHADOW_INT_MOV_SS);