From: Gleb Natapov Date: Thu, 18 Feb 2010 10:14:59 +0000 (+0200) Subject: KVM: x86 emulator: Forbid modifying CS segment register by mov instruction X-Git-Tag: v2.6.33.1~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8bc4cf28e87f4269773061bac06087c5efe1cc8b;p=karo-tx-linux.git 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 Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index f4e2a49513f1..3b9aca42cd30 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -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);