]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: x86 emulator: Forbid modifying CS segment register by mov instruction
authorGleb Natapov <gleb@redhat.com>
Thu, 18 Feb 2010 10:14:59 +0000 (12:14 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Mar 2010 16:07:11 +0000 (09:07 -0700)
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>
arch/x86/kvm/emulate.c

index f4e2a49513f11cdaee1fd76b9d5e586bfc8e8320..3b9aca42cd30664edbf3e75498119d48ecf863d3 100644 (file)
@@ -1987,6 +1987,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);