]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
KVM: x86 emulator: refuse SrcMemFAddr (e.g. LDS) with register operand
authorAvi Kivity <avi@redhat.com>
Thu, 26 Aug 2010 08:06:15 +0000 (11:06 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:51:35 +0000 (10:51 +0200)
SrcMemFAddr is not defined with the modrm operand designating a register
instead of a memory address.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/emulate.c

index ec35a71d8b5d155c2bf015c5d82c848ff94c09e0..2b9b0feabdba934622d2fac014dcb73d309e16bf 100644 (file)
@@ -2974,6 +2974,11 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
                goto done;
        }
 
+       if ((c->d & SrcMask) == SrcMemFAddr && c->src.type != OP_MEM) {
+               emulate_ud(ctxt);
+               goto done;
+       }
+
        /* Privileged instruction can be executed only in CPL=0 */
        if ((c->d & Priv) && ops->cpl(ctxt->vcpu)) {
                emulate_gp(ctxt, 0);