summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Upton <oupton@google.com>2020-02-07 02:36:04 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-19 19:54:11 +0100
commitc289fca8bd8e6742be7c3f92a60d7fa756202457 (patch)
tree6c92959ad298e06d87f0c5745c2de260b37bf6f6
parent57f7a8840f94f1693b03c977f4702682982c5581 (diff)
downloadlinux-c289fca8bd8e6742be7c3f92a60d7fa756202457.tar.gz
linux-c289fca8bd8e6742be7c3f92a60d7fa756202457.tar.bz2
linux-c289fca8bd8e6742be7c3f92a60d7fa756202457.zip
KVM: x86: Mask off reserved bit from #DB exception payload
commit 307f1cfa269657c63cfe2c932386fcc24684d9dd upstream. KVM defines the #DB payload as compatible with the 'pending debug exceptions' field under VMX, not DR6. Mask off bit 12 when applying the payload to DR6, as it is reserved on DR6 but not the 'pending debug exceptions' field. Fixes: f10c729ff965 ("kvm: vmx: Defer setting of DR6 until #DB delivery") Signed-off-by: Oliver Upton <oupton@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kvm/x86.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d744c1bf4dc8..e594fd2719dd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -437,6 +437,14 @@ void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu)
* for #DB exceptions under VMX.
*/
vcpu->arch.dr6 ^= payload & DR6_RTM;
+
+ /*
+ * The #DB payload is defined as compatible with the 'pending
+ * debug exceptions' field under VMX, not DR6. While bit 12 is
+ * defined in the 'pending debug exceptions' field (enabled
+ * breakpoint), it is reserved and must be zero in DR6.
+ */
+ vcpu->arch.dr6 &= ~BIT(12);
break;
case PF_VECTOR:
vcpu->arch.cr2 = payload;