Re: [PATCH 1/2][KVM] nVMX x86: Add a check for reserved bits [11:0] of PML address

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

 



On Wed, Sep 26, 2018 at 02:18:11PM -0400, Krish Sadhukhan wrote:
> According to section "Checks on VMX Controls" in Intel SDM vol 3C, bits 11:0
> of the PML address must be 0.
> 
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>
> Reviewed-by: Mark Kanda <mark.kanda@xxxxxxxxxx>
> ---
>  arch/x86/include/asm/vmx.h | 2 ++
>  arch/x86/kvm/vmx.c         | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
> index 9527ba5..2c118ad 100644
> --- a/arch/x86/include/asm/vmx.h
> +++ b/arch/x86/include/asm/vmx.h
> @@ -339,6 +339,8 @@ enum vmcs_field {
>  	HOST_RIP                        = 0x00006c16,
>  };
>  
> +#define	PML_ADDRESS_RESV_BITS		0xfff
> +
>  /*
>   * Interruption-information format
>   */
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 533a327..49e707d 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -11712,7 +11712,8 @@ static int nested_vmx_check_pml_controls(struct kvm_vcpu *vcpu,
>  	if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_PML)) {
>  		if (!nested_cpu_has_ept(vmcs12) ||
>  		    !IS_ALIGNED(address, 4096)  ||
> -		    address >> maxphyaddr)
> +		    address >> maxphyaddr ||
> +		    address & PML_ADDRESS_RESV_BITS)

This check is handled by "!IS_ALIGNED(address, 4096)".  There's also
existing unit test coverage for this, albeit it's not what one would
describe as exhaustive, e.g.:

	test_vmcs_page_addr(name, encoding, ignored,
			    xfail_beyond_mapped_ram, PAGE_SIZE - 1);

Is there a failure associated with this series or was this prompted
by inspection?

>  			return -EINVAL;
>  	}
>  
> -- 
> 2.9.5
> 



[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