aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-02-18 12:14:59 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 12:36:13 -0300
commit8b9f44140bc4afd2698413cd9960c3912168ee91 (patch)
tree5b146e027487435e8cd1ddb2aa27c4dcde640a42 /arch/x86
parent70e335e16882df5b5d6971022e63c3603a1e8c23 (diff)
downloadkernel_samsung_smdk4412-8b9f44140bc4afd2698413cd9960c3912168ee91.zip
kernel_samsung_smdk4412-8b9f44140bc4afd2698413cd9960c3912168ee91.tar.gz
kernel_samsung_smdk4412-8b9f44140bc4afd2698413cd9960c3912168ee91.tar.bz2
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 <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-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 c280c23..2db760f 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);