Skip to content

Commit

Permalink
KVM: Fix vmload and friends misinterpreted as lidt
Browse files Browse the repository at this point in the history
The AMD SVM instruction family all overload the 0f 01 /3 opcode, further
multiplexing on the three r/m bits.  But the code decided that anything that
isn't a vmmcall must be an lidt (which shares the 0f 01 /3 opcode, for the
case that mod = 3).

Fix by aborting emulation if this isn't a vmmcall.

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Avi Kivity committed Mar 24, 2009
1 parent e207831 commit 2b3d2a2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/x86/kvm/x86_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,11 +1908,16 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
c->dst.type = OP_NONE;
break;
case 3: /* lidt/vmmcall */
if (c->modrm_mod == 3 && c->modrm_rm == 1) {
rc = kvm_fix_hypercall(ctxt->vcpu);
if (rc)
goto done;
kvm_emulate_hypercall(ctxt->vcpu);
if (c->modrm_mod == 3) {
switch (c->modrm_rm) {
case 1:
rc = kvm_fix_hypercall(ctxt->vcpu);
if (rc)
goto done;
break;
default:
goto cannot_emulate;
}
} else {
rc = read_descriptor(ctxt, ops, c->src.ptr,
&size, &address,
Expand Down

0 comments on commit 2b3d2a2

Please sign in to comment.