Re: [kvm-unit-tests PATCH] x86: vmx: Mask undefined bits in exit qualifications

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

 



On 18/06/19 00:22, Krish Sadhukhan wrote:
> 
> 
> On 06/17/2019 12:52 PM, Nadav Amit wrote:
>>> On May 3, 2019, at 10:49 AM, nadav.amit@xxxxxxxxx wrote:
>>>
>>> From: Nadav Amit <nadav.amit@xxxxxxxxx>
>>>
>>> On EPT violation, the exit qualifications may have some undefined bits.
>>>
>>> Bit 6 is undefined if "mode-based execute control" is 0.
>>>
>>> Bits 9-11 are undefined unless the processor supports advanced VM-exit
>>> information for EPT violations.
>>>
>>> Right now on KVM these bits are always undefined inside the VM (i.e., in
>>> an emulated VM-exit). Mask these bits to avoid potential false
>>> indication of failures.
>>>
>>> Signed-off-by: Nadav Amit <nadav.amit@xxxxxxxxx>
>>> ---
>>> x86/vmx.h       | 20 ++++++++++++--------
>>> x86/vmx_tests.c |  4 ++++
>>> 2 files changed, 16 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/x86/vmx.h b/x86/vmx.h
>>> index cc377ef..5053d6f 100644
>>> --- a/x86/vmx.h
>>> +++ b/x86/vmx.h
>>> @@ -603,16 +603,20 @@ enum vm_instruction_error_number {
>>> #define EPT_ADDR_MASK        GENMASK_ULL(51, 12)
>>> #define PAGE_MASK_2M        (~(PAGE_SIZE_2M-1))
>>>
>>> -#define EPT_VLT_RD        1
>>> -#define EPT_VLT_WR        (1 << 1)
>>> -#define EPT_VLT_FETCH        (1 << 2)
>>> -#define EPT_VLT_PERM_RD        (1 << 3)
>>> -#define EPT_VLT_PERM_WR        (1 << 4)
>>> -#define EPT_VLT_PERM_EX        (1 << 5)
>>> +#define EPT_VLT_RD        (1ull << 0)
>>> +#define EPT_VLT_WR        (1ull << 1)
>>> +#define EPT_VLT_FETCH        (1ull << 2)
>>> +#define EPT_VLT_PERM_RD        (1ull << 3)
>>> +#define EPT_VLT_PERM_WR        (1ull << 4)
>>> +#define EPT_VLT_PERM_EX        (1ull << 5)
>>> +#define EPT_VLT_PERM_USER_EX    (1ull << 6)
>>> #define EPT_VLT_PERMS        (EPT_VLT_PERM_RD | EPT_VLT_PERM_WR | \
>>>                  EPT_VLT_PERM_EX)
>>> -#define EPT_VLT_LADDR_VLD    (1 << 7)
>>> -#define EPT_VLT_PADDR        (1 << 8)
>>> +#define EPT_VLT_LADDR_VLD    (1ull << 7)
>>> +#define EPT_VLT_PADDR        (1ull << 8)
>>> +#define EPT_VLT_GUEST_USER    (1ull << 9)
>>> +#define EPT_VLT_GUEST_WR    (1ull << 10)
> 
> This one should be named EPT_VLT_GUEST_RW,  assuming you are naming them
> according to the 1-setting of the bits.

Applied with this change, thanks.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux