From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH 1/4] KVM: x86: Move the check for upper 32 reserved bits of DR6 to separate function
Date: Fri, 22 May 2020 18:19:51 -0400 [thread overview]
Message-ID: <20200522221954.32131-2-krish.sadhukhan@oracle.com> (raw)
In-Reply-To: <20200522221954.32131-1-krish.sadhukhan@oracle.com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
---
arch/x86/kvm/x86.c | 2 +-
arch/x86/kvm/x86.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c17e6eb..4746ec1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1096,7 +1096,7 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
case 4:
/* fall through */
case 6:
- if (val & 0xffffffff00000000ULL)
+ if (!kvm_dr6_valid(val))
return -1; /* #GP */
vcpu->arch.dr6 = (val & DR6_VOLATILE) | kvm_dr6_fixed(vcpu);
break;
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index b968acc..5043108 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -354,6 +354,11 @@ static inline bool kvm_dr7_valid(u64 data)
/* Bits [63:32] are reserved */
return !(data >> 32);
}
+static inline bool kvm_dr6_valid(u64 data)
+{
+ /* Bits [63:32] are reserved */
+ return !(data >> 32);
+}
void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu);
void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu);
--
1.8.3.1
next prev parent reply other threads:[~2020-05-22 23:02 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 ` Krish Sadhukhan [this message]
2020-05-22 22:19 ` [PATCH 2/4] KVM: nSVM: Check that DR6[63:32] and DR7[64:32] are not set " Krish Sadhukhan
2020-05-22 22:19 ` [PATCH 3/4] kvm-unit-tests: nSVM: Test that DR6[63:32], DR7[63:32] and EFER reserved bits " 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-2-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).