From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932199AbcGTW0H (ORCPT ); Wed, 20 Jul 2016 18:26:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39745 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932173AbcGTW0E (ORCPT ); Wed, 20 Jul 2016 18:26:04 -0400 From: Bandan Das To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] nvmx: check for shadow vmcs check on entry Date: Wed, 20 Jul 2016 18:25:36 -0400 Message-Id: <1469053536-11130-5-git-send-email-bsd@redhat.com> In-Reply-To: <1469053536-11130-1-git-send-email-bsd@redhat.com> References: <1469053536-11130-1-git-send-email-bsd@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Jul 2016 22:25:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vmentry should check whether the vmcs provided by the guest hypervisor is a shadow vmcs and fail. Also, vmptrld should check whether a shadow vmcs is being loaded by the guest without support being present but this check happens as part of checking the revision_id. Signed-off-by: Bandan Das --- arch/x86/kvm/vmx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6291143..1b6f624 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -9924,6 +9924,10 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) skip_emulated_instruction(vcpu); vmcs12 = get_vmcs12(vcpu); + if ((vmcs12->revision_id >> 31) & 1u) { + nested_vmx_failInvalid(vcpu); + return 1; + } if (enable_shadow_vmcs) copy_shadow_to_vmcs12(vmx); -- 2.5.5