From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v5 13/13] KVM/nVMX: Use page_address_valid in a few more locations Date: Wed, 23 Jan 2019 13:18:09 -0500 Message-ID: <20190123181807.GS19289@Konrads-MacBook-Pro.local> References: <1547026933-31226-1-git-send-email-karahmed@amazon.de> <1547026933-31226-14-git-send-email-karahmed@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com To: KarimAllah Ahmed Return-path: Content-Disposition: inline In-Reply-To: <1547026933-31226-14-git-send-email-karahmed@amazon.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Jan 09, 2019 at 10:42:13AM +0100, KarimAllah Ahmed wrote: > Use page_address_valid in a few more locations that is already checking for > a page aligned address that does not cross the maximum physical address. Where is this page_address_valid declared? The latest linus's tree does not have it, nor does your patchset? > > Signed-off-by: KarimAllah Ahmed > --- > arch/x86/kvm/vmx/nested.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index ccb3b63..77aad46 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -4203,7 +4203,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu) > * Note - IA32_VMX_BASIC[48] will never be 1 for the nested case; > * which replaces physical address width with 32 > */ > - if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) > + if (!page_address_valid(vcpu, vmptr)) > return nested_vmx_failInvalid(vcpu); > > if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) || > @@ -4266,7 +4266,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu) > if (nested_vmx_get_vmptr(vcpu, &vmptr)) > return 1; > > - if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) > + if (!page_address_valid(vcpu, vmptr)) > return nested_vmx_failValid(vcpu, > VMXERR_VMCLEAR_INVALID_ADDRESS); > > @@ -4473,7 +4473,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) > if (nested_vmx_get_vmptr(vcpu, &vmptr)) > return 1; > > - if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) > + if (!page_address_valid(vcpu, vmptr)) > return nested_vmx_failValid(vcpu, > VMXERR_VMPTRLD_INVALID_ADDRESS); > > -- > 2.7.4 >