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.34-rc1~193^2~5 X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=8b9f44140bc4afd2698413cd9960c3912168ee91;p=~andy%2Flinux KVM: x86 emulator: Forbid modifying CS segment register by mov instruction Inject #UD if guest attempts to do so. This is in accordance to Intel SDM. Cc: stable@kernel.org (2.6.33, 2.6.32) Signed-off-by: Gleb Natapov Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c280c2352f7..2db760ff887 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2126,6 +2126,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);