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

Re: [Xen-devel] [XTF PATCH 07/16] vvmx: test vmxon in CPL=3 and out of VMX operation



On 19/12/16 03:35, Haozhong Zhang wrote:
> On 12/16/16 20:33 +0000, Andrew Cooper wrote:
>> On 16/12/16 13:43, Haozhong Zhang wrote:
>>> diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c
>>> index 31f074c..ca33b3c 100644
>>> --- a/tests/vvmx/vmxon.c
>>> +++ b/tests/vvmx/vmxon.c
>>> @@ -28,11 +28,42 @@ static bool test_vmxon_novmxe(void)
>>>                                VMXERR_FAULT, EXINFO_SYM(UD, 0), 0);
>>>  }
>>>
>>> +static unsigned long vmxon_in_user(void)
>>
>> I'd name this user_vmxon() as it is slightly shorter, but I'm not
>> terribly fussed.
>>
>>> +{
>>> +    exinfo_t fault;
>>> +    unsigned long ret = vmxon((uint64_t)vmxon_region, &fault);
>>> +
>>> +    return (ret << 32) | fault;
>>> +}
>>> +
>>> +/**
>>> + * vmxon in CPL=3 and out of VMX operation
>>> + *
>>> + * Expect: #GP(0)
>>> + */
>>> +static bool test_vmxon_in_user(void)
>>
>> Similarly, test_user_vmxon()
>>
>
> I'll turn to shorter names.
>
>>> +{
>>> +    clear_vmcs(vmxon_region, get_vmcs_revid());
>>> +
>>> +    unsigned long ret = exec_user(vmxon_in_user);
>>> +    uint8_t err = (ret >> 32) & 0xff;
>>> +    exinfo_t fault = ret & 0xFFFFFFFF;
>>> +
>>> +    return handle_vmxinsn_err(__func__, err, fault,
>>> +                              VMXERR_FAULT, EXINFO_SYM(GP, 0), 0);
>>> +}
>>> +
>>>  bool test_vmxon(void)
>>>  {
>>>      if ( !test_vmxon_novmxe() )
>>>          return false;
>>
>> Your subject says out of VMX operation, but the implementation is inside
>> VMX operation.
>>
>
> vmxon in test_vmxon_novmxe() fails if test_vmxon_novmxe() return true,
> so here we are still out of VMX operation.

Very good point.  Its obvious now you point it out.  Sorry for the noise.

~andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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