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

Re: [Xen-devel] [DO NOT APPLY PATCH XTF 0/2] UMIP test case



On 02/03/17 12:30, Yu Zhang wrote:
> Wah. Thank you,  Andrew & Wei. :-)
>
> On 3/2/2017 5:05 PM, Andrew Cooper wrote:
>> On 02/03/2017 08:42, Wei Liu wrote:
>>> I wrote this long time ago before UMIP was merged.
>>>
>>> Yu, since you asked, I might as well post it for your reference on
>>> how to
>>> do it with XTF.
>>>
>>> This series is not yet tested in any way.
>> Unfortunately, you execute all of the sensitive instructions in kernel
>> mode, where they wouldn't fault even with UMIP active.
>>
>> For full testing of a feature like this, the test should include a check
>> that the ability to modify CR4.UMIP depends strictly on the visibility
>> of the feature, that uses in the kernel still continue to work, even
>> when active, and that behaviour returns back to normal after the feature
>> has been deactivated.
>
> So, before cr4 is written, a cpuid is needed first in the test code,
> right?

Yes, but that is performed automatically by the framework for
convenience.  The predicate cpu_has_umip will work fine for your test.

>
> But besides the emulation of cpuid and cr4, my understanding is that
> hypervisor need to inject a GP fault if an instruction causes a VM
> exit, right? This should be different than the normal GP fault inside
> a VM, and how do we test this code path?

Using the Force Emulation Prefix.  This breaks out to the hypervisor and
runs the instruction through the emulator.  You should test both that
the native instructions behave as expected, and that once forced, the
instructions also behave sensibly.

The FEP test is to cover alternative cases with would require emulation
normally (e.g. memory operand hitting an MMIO region, or the page marked
NX in EPT because of VM instrospection being active).

>
> Our QA and I may need to have a study of the XTF, and may probably
> seek for your help in the future. :-)
> Anyway, thanks a lot!

Haozhong (CC'd) has previously used XTF for a load of nested-virt
testing, if you'd like an alternative opinion, (although I do hope you
find XTF easy to use and useful).

~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®.