From patchwork Mon Mar 13 10:51:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9620465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A68460414 for ; Mon, 13 Mar 2017 10:54:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D7822843F for ; Mon, 13 Mar 2017 10:54:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3252628459; Mon, 13 Mar 2017 10:54:11 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C56362843F for ; Mon, 13 Mar 2017 10:54:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnNa1-0007PN-TE; Mon, 13 Mar 2017 10:51:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnNa0-0007Ol-C9 for xen-devel@lists.xen.org; Mon, 13 Mar 2017 10:51:56 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 36/E6-01896-BC976C85; Mon, 13 Mar 2017 10:51:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHSDve7pymM RBhMnSlks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlf711iLPjNVtFw+RJTA+MV1i5GTg4JAX+J 64fWsIHYbAJ6Ehtnv2ICsUUEZCVWd81h72Lk4mAWOMIoMXXVEXaQhLCAq8SiE89YQGwWAVWJg 9O3gTXzCthKHDg9gRliqJzEpW1fgGwODk4BO4nzB/hBwkJAJU8v3WeEsFUlXr/YxQLRKihxcu YTMJtZQELi4IsXzBMYeWchSc1CklrAyLSKUaM4tagstUjX0FwvqSgzPaMkNzEzR9fQwFQvN7W 4ODE9NScxqVgvOT93EyMweBiAYAfjxdOehxglOZiURHnfNh+KEOJLyk+pzEgszogvKs1JLT7E KMPBoSTB+/kMUE6wKDU9tSItMwcYxjBpCQ4eJRFe87NAad7igsTc4sx0iNQpRl2OG8cPvGESY snLz0uVEuf9CzJDAKQoozQPbgQspi4xykoJ8zICHSXEU5BalJtZgir/ilGcg1FJmDcHZBVPZl 4J3KZXQEcwAR0xje8gyBEliQgpqQbGWSqT+wxlV69lVznbH3EscfOG3fYN29OnPtw2/ZqAipT 7XKaHd5/fdPK1uJbjXmUssLl5iY9Ljp/gN3mr9jV1edU5oqkzSq7kTen44fzgX+gLs9DrbqJe zELv//OV1a11mHnGS1PhFG9UrdqMa0aMni8jX/9Zvv3ShVuLJ2w/LF2+btm+pimsSizFGYmGW sxFxYkAwkQ87aQCAAA= X-Env-Sender: prvs=23829f5b7=sergey.dyasli@citrix.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1489402313!86280350!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50404 invoked from network); 13 Mar 2017 10:51:55 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 13 Mar 2017 10:51:55 -0000 X-IronPort-AV: E=Sophos;i="5.36,158,1486425600"; d="scan'208";a="422224506" From: Sergey Dyasli To: Date: Mon, 13 Mar 2017 10:51:43 +0000 Message-ID: <20170313105143.20842-4-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170313105143.20842-1-sergey.dyasli@citrix.com> References: <20170313105143.20842-1-sergey.dyasli@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Kevin Tian , Jan Beulich , Jun Nakajima , Sergey Dyasli Subject: [Xen-devel] [PATCH v1 3/3] x86/vvmx: add a shadow vmcs check to vmlaunch X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Intel SDM states that if the current VMCS is a shadow VMCS, VMFailInvalid occurs and control passes to the next instruction. Implement such behaviour for nested vmlaunch. Signed-off-by: Sergey Dyasli Acked-by: Kevin Tian Reviewed-by: Krish Sadhukhan --- xen/arch/x86/hvm/vmx/vvmx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 3017849..173ec74 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1630,6 +1630,13 @@ int nvmx_handle_vmlaunch(struct cpu_user_regs *regs) return X86EMUL_OKAY; } + /* Check that guest is not using a shadow vmcs for vmentry */ + if ( nvmx->shadow_vmcs ) + { + vmfail_invalid(regs); + return X86EMUL_OKAY; + } + __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow); if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS ) {