From: Saul Freedman <fre3dm4n@gmail.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org,
Saul Freedman <fre3dm4n@gmail.com>
Subject: [PATCH RFC 0/1] Fix ICEBP handling after KVM debug exits
Date: Thu, 20 Aug 2026 06:13:54 +0000 [thread overview]
Message-ID: <20260820061355.196465-1-fre3dm4n@gmail.com> (raw)
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
next reply other threads:[~2026-08-20 6:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 6:13 Saul Freedman [this message]
2026-08-20 6:13 ` [PATCH RFC 1/1] target/i386: skip ICEBP before reinjecting #DB Saul Freedman
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=20260820061355.196465-1-fre3dm4n@gmail.com \
--to=fre3dm4n@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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