[PATCH v6 05/12] KVM: x86: Set guest's fixed-1 DR6 bits when delivering #DB payload

From: Sean Christopherson

Date: Wed Sep 30 2026 - 17:37:01 EST


When delivering a #DB payload, set all DR6 bits that are fixed-1 from the
guest's perspective, not just the host's perspective. Don't WARN on a
"bad" payload (or existing DR6) even though KVM itself shouldn't set DR6
or synthesize a payload without the fixed-1 bits set, as userspace can
provide a completely arbitrary payload via KVM_SET_VCPU_EVENTS (and
"hardening" that flow is not worth the effort as there's no benefit in
practice).

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 99518e3265b4..816c6df8dcea 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -440,7 +440,7 @@ void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu,
* breakpoint), it is reserved and must be zero in DR6.
*/
vcpu->arch.dr6 &= ~BIT(12);
- vcpu->arch.dr6 |= DR6_FIXED_1;
+ vcpu->arch.dr6 |= kvm_get_dr6_fixed_1(vcpu);
break;
case PF_VECTOR:
vcpu->arch.cr2 = ex->payload;
--
2.56.0.rc1.315.gc6ed9934b7-goog