Skip to content

Commit

Permalink
KVM: nSVM: Check for CR0.CD and CR0.NW on VMRUN of nested guests
Browse files Browse the repository at this point in the history
According to section "Canonicalization and Consistency Checks" in APM vol. 2,
the following guest state combination is illegal:

	"CR0.CD is zero and CR0.NW is set"

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20200409205035.16830-2-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Krish Sadhukhan authored and Paolo Bonzini committed Apr 21, 2020
1 parent a9ab13f commit 4f23337
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/x86/kvm/svm/nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ static bool nested_vmcb_checks(struct vmcb *vmcb)
if ((vmcb->save.efer & EFER_SVME) == 0)
return false;

if (((vmcb->save.cr0 & X86_CR0_CD) == 0) &&
(vmcb->save.cr0 & X86_CR0_NW))
return false;

if ((vmcb->control.intercept & (1ULL << INTERCEPT_VMRUN)) == 0)
return false;

Expand Down

0 comments on commit 4f23337

Please sign in to comment.