Skip to content

Commit

Permalink
KVM: x86 emulator: Forbid modifying CS segment register by mov instru…
Browse files Browse the repository at this point in the history
…ction

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>
  • Loading branch information
Gleb Natapov authored and Marcelo Tosatti committed Mar 1, 2010
1 parent 70e335e commit 8b9f441
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,12 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
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);

Expand Down

0 comments on commit 8b9f441

Please sign in to comment.