Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp523467imu; Wed, 9 Jan 2019 01:44:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN4LJpBu9rWoxlbaEEUHVF/w+xtvGK/ijWghbzDs2ryXILdCOA2JAxGfqZIghE10NO5tyilP X-Received: by 2002:a63:d50f:: with SMTP id c15mr4733072pgg.287.1547027062707; Wed, 09 Jan 2019 01:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547027062; cv=none; d=google.com; s=arc-20160816; b=RqcvHyUKNn5BB+mKqZrZTZG/4WysMRf5vCLiBZVmrULT6cQNIIIV5ASq73RMNzGLnR fbvbDbQhrCVOlD6ExjAk8jjiZzc33ABlZpcaT12CrgpNEZvYNnSeAwR9J3YpjXwRrDiI kwwWBWRa+dIuYsjiQI25XrkbBgRueCtReHMZM00sjMpDArKDigxxlrGMsrEG/gDE+dat mnYpGas68zTTIprsCyZ1M86dIZ3jivF+sooB8zqSI1yhFdvRSFbaox9o/qzTppm6u7QF 9lwzS0u57ae3QG58bvuJTHVZZh71bKFpgbjVfsIFKExZPjjQKbuQW25zPNrzsDXQLvJh ijag== 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=+11XopSD3NZi17fwFjmUAyip5g6Y8L0FisE7NG2U+iQ=; b=n7d2XWx0jD74gZRpmTOM1vdv2XSXFeLp4l3SC9kBs8jzyrZyGqFRyssCxi4JDycpYT tnu6UZrMTWA5NInqJz8LjG/mjlZUiOlv3a08T6zvZH6gEd175u7yUteKtVAGoOPU8PMD i5cVMylSRHEU7G2nQ5RY8PfvV32ERO/V76SB1fGAu+vmLAVkBm1hFBMTAk5GeMcp0jNE qo/EiZl5eaY0cBd1LDXWaUrqFsCnjJv9jxGreukMmmLDcowO4rcVnC6906PGXk8ATPWl f6yO9EBfdxNMySRmi3wzJS9V/VtWhC0AWgKLsR61BkUWx53nvOyCVTxeZCxV0NciX9ej lrwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b="HIHb/0Cl"; 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 n32si3383387pgm.439.2019.01.09.01.44.06; Wed, 09 Jan 2019 01:44:22 -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="HIHb/0Cl"; 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 S1730568AbfAIJmn (ORCPT + 99 others); Wed, 9 Jan 2019 04:42:43 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:53731 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730520AbfAIJmc (ORCPT ); Wed, 9 Jan 2019 04:42:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1547026951; x=1578562951; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=+11XopSD3NZi17fwFjmUAyip5g6Y8L0FisE7NG2U+iQ=; b=HIHb/0ClZtu02uFjDftnvMtkheGlDSFaFZxuV8CS64JpZnDsAiUeRWm5 M2AXBgQp8Rg9hLKxY68DZcsx2agfmgMtVXPi/NWkmrT45FraH1RDTpO5V Hrh8tR0eA/GYIf95DLxcgssBR4+7p4A4yd3FGVVpvP5OtMjAzm9WOhUz6 w=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="380876341" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-4e24fd92.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Jan 2019 09:42:28 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2b-4e24fd92.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x099gNjO069861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Jan 2019 09:42:24 GMT 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 x099gMHQ031351; Wed, 9 Jan 2019 10:42:23 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id x099gMEo031350; Wed, 9 Jan 2019 10:42:22 +0100 From: KarimAllah Ahmed To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Cc: KarimAllah Ahmed Subject: [PATCH v5 13/13] KVM/nVMX: Use page_address_valid in a few more locations Date: Wed, 9 Jan 2019 10:42:13 +0100 Message-Id: <1547026933-31226-14-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547026933-31226-1-git-send-email-karahmed@amazon.de> References: <1547026933-31226-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 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