From patchwork Mon Oct 23 09:33:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 10022251 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 45D9460245 for ; Mon, 23 Oct 2017 09:35:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37095286AA for ; Mon, 23 Oct 2017 09:35:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AF35286CC; Mon, 23 Oct 2017 09:35:38 +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 8DE10286AA for ; Mon, 23 Oct 2017 09:35:37 +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 1e6Z6b-0002Hs-Rs; Mon, 23 Oct 2017 09:33:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6Z6a-0002Hl-Bw for xen-devel@lists.xen.org; Mon, 23 Oct 2017 09:33:08 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 37/D1-25852-357BDE95; Mon, 23 Oct 2017 09:33:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRWlGSWpSXmKPExsXitHSDvW7w9re RBssfiFgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlXN55hKXjIWdH55S1rA2MbRxcjJ4eEgL/E jXVdbCA2m4CexMbZr5hAbBEBWYnVXXPYuxi5OJgFjjBKTF11hB0kISzgLfFt3VmgBg4OFgFVi VtLnEDCvAK2EpOvfmaDmCkvsavtIiuILQRU8vrFLhaIGkGJkzOfgNnMAhISB1+8YJ7AyD0LSW oWktQCRqZVjBrFqUVlqUW6RpZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBwcA ABDsYDywKPMQoycGkJMr7O+dtpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3n9bgXKCRanpqRVp mTnAsIRJS3DwKInwvgdJ8xYXJOYWZ6ZDpE4x6nJ03Lz7h0mIJS8/L1VKnNd/G1CRAEhRRmke3 AhYjFxilJUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMG8JyBSezLwSuE2vgI5gAjpC1v4NyBEliQ gpqQbGnP13/lRJqEUfSTGYZjbzqsXxms9Fz112fc2b/KdQiyMuJePnyxfLvjl3dW4VupM9LW/ LkR9cD6fsi7h+9ZdfWkLWd/tD3kfs8/fcKnP5yhCzc2t7/NKnTsWSh5tMMk/J1Pxd77lGf8bz t1Pt8lZnd+xkfVfg93hGvfOPMxN2bw2/FPJ5rdSURUosxRmJhlrMRcWJAGnJQ6mMAgAA X-Env-Sender: prvs=462773e7a=sergey.dyasli@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1508751185!53372590!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.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8655 invoked from network); 23 Oct 2017 09:33:07 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Oct 2017 09:33:07 -0000 X-IronPort-AV: E=Sophos;i="5.43,422,1503360000"; d="scan'208";a="455511028" From: Sergey Dyasli To: Date: Mon, 23 Oct 2017 10:33:02 +0100 Message-ID: <20171023093302.27953-1-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Andrew Cooper , Kevin Tian , Jan Beulich , Jun Nakajima , Sergey Dyasli Subject: [Xen-devel] [PATCH v1] x86/vvmx: don't enable vmcs shadowing for nested guests 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 Running "./xtf_runner vvmx" in L1 Xen under L0 Xen produces the following result on H/W with VMCS shadowing: Test: vmxon Failure in test_vmxon_in_root_cpl0() Expected 0x8200000f: VMfailValid(15) VMXON_IN_ROOT Got 0x82004400: VMfailValid(17408) Test result: FAILURE This happens because SDM allows vmentries with enabled VMCS shadowing VM-execution control and VMCS link pointer value of ~0ull. But results of a nested VMREAD are undefined in such cases. Fix this by not copying the value of VMCS shadowing control from vmcs01 to vmcs02. Signed-off-by: Sergey Dyasli Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/vvmx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index dde02c076b..013d049f8a 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -633,6 +633,7 @@ void nvmx_update_secondary_exec_control(struct vcpu *v, SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY; host_cntrl &= ~apicv_bit; + host_cntrl &= ~SECONDARY_EXEC_ENABLE_VMCS_SHADOWING; shadow_cntrl = get_vvmcs(v, SECONDARY_VM_EXEC_CONTROL); /* No vAPIC-v support, so it shouldn't be set in vmcs12. */