Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp64318ima; Thu, 31 Jan 2019 12:28:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7JSybI/SC8U9zsWa9uoywNtdA0LOaXRTrj7llO9ecRujskvBTgwWDyY+mIRsqsWU1SwUR7 X-Received: by 2002:a17:902:7b91:: with SMTP id w17mr36283983pll.111.1548966487559; Thu, 31 Jan 2019 12:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548966487; cv=none; d=google.com; s=arc-20160816; b=X8aiHRDMCv2y8vkRe9erEJl3Z8Vaeh2sJhrPqJAwgwGRda+HPFjfJzkNKmGmPHZ9e8 Qi8iUehx65EuJQoGNcjwMN817YuSOB8gtDuMjJbIADLa6uyMb4XBMCPz6Sphp/9Hoy8T OrvfXm6lpx6urROL4mX42VjPYEhRWv4K4B50OfN47bxKuk7Hivg2eWnp8TwpIKj17ACZ njXrqTO7uOaCKFgSpe6bh3sl+KghzO4A5YdpObVNAFwg+I7WJ2xwB/2KBnEzFWEh/F4n 2w+9VpwDf7RLMjQatXzu/S+yrNvgFDMsoqzPrKuXm6bT7HCsLR+N3eru2miUaqy1SRj8 dBXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=vpQWtJIGuD5wkDbOzUOZfHizrC9+qDCSo/WPfD0I3Bo=; b=lkkyu/8dteMq/zr0EEogX9yylTKBf4VtuKTBBefBGRoiCSWk8mqTT+jv2y9y3ZTdut q11wD5MU94PHyVVCnjW0Yp7onId/pxndtELtvTBNJbw+TfLFuwYZzPfHhxY5sOAM+sh0 3QalDy3W2nbrHnrGgfa2ZE7WKkbIlybHXu2irWXShtQJY2C8FaZHTwTCMYy8+Wc09E8j +tQB9ddZsktJrtoTcHOZitA5XztG5Kb0dYWSfuLZcd61QTAsnFFRlw+Qisvai4H1Z41D 9OyLw7IWu+uD7ikPjVIGWEQfpSfdhHCsYGnxzkj2VE/2DpkfMvCl4gWmKcJDMPEr30xc UXZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=VcXDtTdo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si4715109pgn.278.2019.01.31.12.27.52; Thu, 31 Jan 2019 12:28:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=VcXDtTdo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728578AbfAaU1P (ORCPT + 99 others); Thu, 31 Jan 2019 15:27:15 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:11886 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727918AbfAaU1L (ORCPT ); Thu, 31 Jan 2019 15:27:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1548966431; x=1580502431; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=vpQWtJIGuD5wkDbOzUOZfHizrC9+qDCSo/WPfD0I3Bo=; b=VcXDtTdot2O2HaGATVEpwETrD8k+cIO6bAfxOTRe9QeaFv+58XJoujAm chocos3DxQ0ALG3dCDFfzA4VwuQl+B8THVBqDPIt+gu/pXFCHOM9GqU5V yAo4TWtOXBhgxszmB+lPKPHvTaIPuB6brk+TfKWUigfWFJx+PNtcN/kFx U=; X-IronPort-AV: E=Sophos;i="5.56,545,1539648000"; d="scan'208";a="784846795" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 31 Jan 2019 20:27:10 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com (Postfix) with ESMTPS id 443AFC512F; Thu, 31 Jan 2019 20:27:10 +0000 (UTC) Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id x0VKR7DN029031; Thu, 31 Jan 2019 21:27:08 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id x0VKR76X029030; Thu, 31 Jan 2019 21:27:07 +0100 From: KarimAllah Ahmed To: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Paolo Bonzini Cc: KarimAllah Ahmed Subject: [PATCH v6 13/14] KVM/nVMX: Use page_address_valid in a few more locations Date: Thu, 31 Jan 2019 21:24:43 +0100 Message-Id: <1548966284-28642-14-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548966284-28642-1-git-send-email-karahmed@amazon.de> References: <1548966284-28642-1-git-send-email-karahmed@amazon.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 60ba582..91e42f9 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