Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH RFC 0/1] Fix ICEBP handling after KVM debug exits
@ 2026-08-20  6:13 Saul Freedman
  2026-08-20  6:13 ` [PATCH RFC 1/1] target/i386: skip ICEBP before reinjecting #DB Saul Freedman
  0 siblings, 1 reply; 2+ messages in thread
From: Saul Freedman @ 2026-08-20  6:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, mtosatti, kvm, Saul Freedman

To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
    Marcelo Tosatti <mtosatti@redhat.com>,
    kvm@vger.kernel.org

KVM normally recognizes ICEBP, advances RIP, and injects #DB itself.
When userspace enables hardware breakpoints, however, KVM reports the
pre-skip #DB through KVM_EXIT_DEBUG.  QEMU currently reinjects it at the
old RIP, causing a debug-exit livelock.

The patch is marked RFC because KVM_EXIT_DEBUG does not preserve KVM's
exact ICEBP classification.  The proposed compatibility heuristic accepts
a causeless #DB whose instruction stream consists only of prefixes and
0xf1.  A durable long-term ABI might instead let KVM expose its exact
classification or advance the instruction before exiting; I would like
feedback from both QEMU and KVM reviewers on that direction.

Validation on an Intel VT-x host:

- Built x86_64-softmmu from current master (ae4f3443209).
- checkpatch reports zero errors and warnings.
- Ran a real Linux guest that executes kernel-mode ICEBP while an
  unrelated hardware breakpoint is installed through QEMU's GDB stub.
  Unpatched QEMU stalls after ICEBP_KERNEL_BEFORE; patched QEMU reaches
  ICEBP_KERNEL_AFTER.

I did not include the hardware reproduction in the patch because it needs
real VT-x, a matching guest kernel build, and a loadable module.  I can
turn the fixture into an optional avocado test if reviewers prefer.

Saul Freedman (1):
  target/i386: skip ICEBP before reinjecting #DB

 target/i386/kvm/kvm.c | 62 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

-- 
2.55.0

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

end of thread, other threads:[~2026-08-20  6:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  6:13 [PATCH RFC 0/1] Fix ICEBP handling after KVM debug exits Saul Freedman
2026-08-20  6:13 ` [PATCH RFC 1/1] target/i386: skip ICEBP before reinjecting #DB Saul Freedman

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