Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.18.y 0/4] KVM: x86: Fix DR6.BLD regression in guests
@ 2026-11-23 12:14 Baoli Zhang
  2026-11-23 12:14 ` [PATCH 6.18.y 1/4] KVM: x86: Rename kvm_dr6_fixed() => kvm_get_dr6_fixed_1() Baoli Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Baoli Zhang @ 2026-11-23 12:14 UTC (permalink / raw)
  To: stable; +Cc: kvm, Sean Christopherson, Paolo Bonzini, Yanx L Liu, Baoli Zhang

Hi,

a58917a271cb ("KVM: x86: Preserve DR6.BLD (Bus Lock Detect) when
delivering #DB payload"), upstream 719a1d58bf43, went into 6.18.61
without the rest of its upstream series. Since then kvm-unit-tests
x86/debug fails on hosts with Bus Lock Detect when the guest CPU model
doesn't have it, e.g. the default qemu64:

  FAIL: Wanted #DB on 0x400da7 w/ DR6 = 0xffff0ff4, got 1 #DBs, addr[0] = 0x400da7, DR6 = 0xffff07f4
  ...
  SUMMARY: 25 tests, 17 unexpected failures

Once KVM stops intercepting DR accesses, the guest's write of 0 to DR6
goes to hardware and clears BLD. sync_dirty_debug_regs() copies that into
vcpu->arch.dr6, and since a58917a271cb the #DB payload path no longer
sets BLD back, so the guest sees it cleared.

Later patches in the same series fix this upstream (v7.4-rc1). This
backports those two fixes and the two cleanups they depend on. Patch 3
needed a small change: 6.18 has no arch/x86/kvm/regs.h, so the new
declaration goes in asm/kvm_host.h.

Tested on an Intel host with bus_lock_detect with a 6.18.64-based kernel
whose DR6 handling matches v6.18.64: x86/debug goes from 17 failures to
all 25 passing.

7.3.y, 6.12.y, 6.6.y and 6.1.y picked up the same commit (in 7.3.2,
6.12.117, 6.6.163 and 6.1.193) and probably need these too. I haven't
tested those, but can send backports if wanted.

Thanks,
Baoli

Sean Christopherson (4):
  KVM: x86: Rename kvm_dr6_fixed() => kvm_get_dr6_fixed_1()
  KVM: Return an "unsigned long", not "u64" for the fixed-1 DR6 bits
  KVM: x86: Force fixed-1 bits in DR6 after synchronizing with hardware
  KVM: x86: Set guest's fixed-1 DR6 bits when delivering #DB payload

 arch/x86/include/asm/kvm_host.h | 1 +
 arch/x86/kvm/regs.c             | 7 ++++---
 arch/x86/kvm/x86.c              | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-23 12:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 12:14 [PATCH 6.18.y 0/4] KVM: x86: Fix DR6.BLD regression in guests Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 1/4] KVM: x86: Rename kvm_dr6_fixed() => kvm_get_dr6_fixed_1() Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 2/4] KVM: Return an "unsigned long", not "u64" for the fixed-1 DR6 bits Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 3/4] KVM: x86: Force fixed-1 bits in DR6 after synchronizing with hardware Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 4/4] KVM: x86: Set guest's fixed-1 DR6 bits when delivering #DB payload Baoli Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox