[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 05/10] x86/SVM: Add AVIC vmexit handlers



On 5/30/2018 2:24 AM, Jan Beulich wrote:
On 30.05.18 at 01:33, <andrew.cooper3@xxxxxxxxxx> wrote:
Would this be better suited ?
Almost.

The purpose of the validate function is to fix an inherent race
condition which occurs with a vmexit.

After a vmexit, rereading the instruction for emulation is inherently
racy, and a malicious VM could rewrite the instruction stream while the
vmexit is occuring.  As a result, we provide a validate function to
check that the instruction decoded matches one which plausibly broke for
emulation here.

Therefore, you want a validate function which checks that the
instruction has a memory operand, and that it falls within the 4k region
which maps the APIC registers.
The validate hook is called right after decode, i.e. before operands have
been evaluated, so the latter part of what you suggest cannot be done.

So check to see if there is a memory operand. Something along the lines of:

bool has_memory_operand(const struct x86_emulate_state *state,
                                                   const struct x86_emulate_ctxt *ctxt)
{
        if ( (state->desc & DstMask) == DstMem )
                return true;

        return false;
}

Thanks,
Janak



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.