From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Subject: Re: [PATCH] KVM/nVMX: Do not validate that posted_intr_desc_addr is page aligned Date: Wed, 24 Oct 2018 04:01:09 -0700 Message-ID: <20181024110109.GA15991@linux.intel.com> References: <1540071779-20848-1-git-send-email-karahmed@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org To: KarimAllah Ahmed Return-path: Content-Disposition: inline In-Reply-To: <1540071779-20848-1-git-send-email-karahmed@amazon.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Sat, Oct 20, 2018 at 11:42:59PM +0200, KarimAllah Ahmed wrote: > The spec only requires the posted interrupt descriptor address to be > 64-bytes aligned (i.e. bits[0:5] == 0). Using page_address_valid also > forces the address to be page aligned. > > Only validate that the address does not cross the maximum physical address > without enforcing a page alignment. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: H. Peter Anvin > Cc: x86@kernel.org > Cc: kvm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Fixes: 6de84e581c0 ("nVMX x86: check posted-interrupt descriptor addresss on vmentry of L2") > Signed-off-by: KarimAllah Ahmed > --- > arch/x86/kvm/vmx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 30bf860..47962f2 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -11668,7 +11668,7 @@ static int nested_vmx_check_apicv_controls(struct kvm_vcpu *vcpu, > !nested_exit_intr_ack_set(vcpu) || > (vmcs12->posted_intr_nv & 0xff00) || > (vmcs12->posted_intr_desc_addr & 0x3f) || > - (!page_address_valid(vcpu, vmcs12->posted_intr_desc_addr)))) > + (vmcs12->posted_intr_desc_addr >> cpuid_maxphyaddr(vcpu))) > return -EINVAL; Can you update the comment for this code block? It has a stale blurb about "the descriptor address has been already checked in nested_get_vmcs12_pages" and it'd be nice to state why bits[5:0] must be zero (your changelog is much more helpful than the current comment). With that: Reviewed-by: Sean Christopherson > > /* tpr shadow is needed by all apicv features. */ > -- > 2.7.4 >