From patchwork Wed Sep 26 18:18:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krish Sadhukhan X-Patchwork-Id: 10616541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A96313A4 for ; Wed, 26 Sep 2018 18:41:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D0D92B356 for ; Wed, 26 Sep 2018 18:41:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 510DB2B35D; Wed, 26 Sep 2018 18:41:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA5762B356 for ; Wed, 26 Sep 2018 18:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbeI0A4E (ORCPT ); Wed, 26 Sep 2018 20:56:04 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:48188 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725733AbeI0A4E (ORCPT ); Wed, 26 Sep 2018 20:56:04 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8QIcmue142973; Wed, 26 Sep 2018 18:41:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=LteFcJ5cZijGO2reVx4UXRMx+07dQrssTmJzWLJv+2Y=; b=pMm0vVhH+yAwJcyKkQH0NxKEQtV59QXo26RI+nYlM8CxBBNgagBKLotm2ZOaDmQj2bjS RhtUavV5VLBC8SDCNkSlKPUFI29c/w9rmHOfF91K2HlnX8aybmWYaTsG+k7x58AAhZkq tynlbIKaCILK4v9ppEMbKP1W9JVUznfoT2g0U43F/+TW83Ba0vce+F87S6ADzthipgVK FAkoz8g4hivHV8t7ll2epRKzRiNGKiHf1UnuVM2KUwBQ7WyJori0E+g26JAUfDpm7F4Z egnPPge3lpqlGewvXAlXrYoyGF9kFHqXqUa4ts+ZZt6Qse2lae+orsOTe6q8lgasAZSK tA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2mndppmepk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Sep 2018 18:41:41 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8QIfejc028936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Sep 2018 18:41:40 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8QIfesd003904; Wed, 26 Sep 2018 18:41:40 GMT Received: from ban25x6uut29.us.oracle.com (/10.153.73.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Sep 2018 11:41:40 -0700 From: Krish Sadhukhan To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, jmattson@google.com Subject: [PATCH 1/2][KVM] nVMX x86: Add a check for reserved bits [11:0] of PML address Date: Wed, 26 Sep 2018 14:18:11 -0400 Message-Id: <20180926181812.30679-2-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180926181812.30679-1-krish.sadhukhan@oracle.com> References: <20180926181812.30679-1-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9028 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=591 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809260173 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Mark Kanda --- 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) return -EINVAL; }