diff options
author | Krish Sadhukhan <krish.sadhukhan@oracle.com> | 2020-04-09 16:50:33 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-04-21 09:13:10 -0400 |
commit | 4f233371f6bb1578340b6c7034ddf7b76606d4ae (patch) | |
tree | e36ba16d940f239cfcca574773baf3179f156bc9 | |
parent | a9ab13ff6e844ad5b3ed39339e6db9a76bb539ad (diff) | |
download | linux-4f233371f6bb1578340b6c7034ddf7b76606d4ae.tar.gz |
KVM: nSVM: Check for CR0.CD and CR0.NW on VMRUN of nested guests
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>
-rw-r--r-- | arch/x86/kvm/svm/nested.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index c62893102777..3e5bd739a6f6 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -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; |