From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH 2/4] KVM: nSVM: Check that DR6[63:32] and DR7[64:32] are not set on vmrun of nested guests
Date: Fri, 22 May 2020 18:19:52 -0400 [thread overview]
Message-ID: <20200522221954.32131-3-krish.sadhukhan@oracle.com> (raw)
In-Reply-To: <20200522221954.32131-1-krish.sadhukhan@oracle.com>
According to section "Canonicalization and Consistency Checks" in APM vol. 2
the following guest state is illegal:
"DR6[63:32] are not zero."
"DR7[63:32] are not zero."
"Any MBZ bit of EFER is set."
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
---
arch/x86/kvm/svm/nested.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 9a2a62e..2fec51d 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -208,6 +208,9 @@ static bool nested_vmcb_checks(struct vmcb *vmcb)
if ((vmcb->save.efer & EFER_SVME) == 0)
return false;
+ if (!kvm_dr6_valid(vmcb->save.dr6) || !kvm_dr7_valid(vmcb->save.dr7))
+ return false;
+
if ((vmcb->control.intercept & (1ULL << INTERCEPT_VMRUN)) == 0)
return false;
--
1.8.3.1
next prev parent reply other threads:[~2020-05-22 23:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 22:19 [PATCH 0/4] KVM: nSVM: Check reserved bits in DR6, DR7 and EFER on vmrun of nested guests Krish Sadhukhan
2020-05-22 22:19 ` [PATCH 1/4] KVM: x86: Move the check for upper 32 reserved bits of DR6 to separate function Krish Sadhukhan
2020-05-22 22:19 ` Krish Sadhukhan [this message]
2020-05-22 22:19 ` [PATCH 3/4] kvm-unit-tests: nSVM: Test that DR6[63:32], DR7[63:32] and EFER reserved bits are not set on vmrun of nested guests Krish Sadhukhan
2020-05-22 22:19 ` [PATCH 4/4] kvm-unit-tests: x86: Remove duplicate instance of 'vmcb' Krish Sadhukhan
2020-06-23 9:04 ` [PATCH 0/4] KVM: nSVM: Check reserved bits in DR6, DR7 and EFER on vmrun of nested guests Paolo Bonzini
2020-07-02 22:33 ` Krish Sadhukhan
2020-07-03 17:09 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200522221954.32131-3-krish.sadhukhan@oracle.com \
--to=krish.sadhukhan@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).