KVM: x86 emulator: do not perform address calculations on linear addresses
authorAvi Kivity <avi@redhat.com>
Wed, 17 Nov 2010 13:28:22 +0000 (15:28 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 12 Jan 2011 09:29:36 +0000 (11:29 +0200)
Linear addresses are supposed to already have segment checks performed on them;
if we play with these addresses the checks become invalid.

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

index e96705542634b2dfa33db23ba38065ffd072504e..bdbbb1839e8996a316c6c1eda4d38fc2034fb22a 100644 (file)
@@ -568,7 +568,8 @@ static int read_descriptor(struct x86_emulate_ctxt *ctxt,
                           ctxt->vcpu, NULL);
        if (rc != X86EMUL_CONTINUE)
                return rc;
-       rc = ops->read_std(linear(ctxt, addr) + 2, address, op_bytes,
+       addr.ea += 2;
+       rc = ops->read_std(linear(ctxt, addr), address, op_bytes,
                           ctxt->vcpu, NULL);
        return rc;
 }