Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86/debug: Verify DR6 is always empty on an INT1/ICEBP #DB
@ 2026-05-14 21:12 Sean Christopherson
  0 siblings, 0 replies; only message in thread
From: Sean Christopherson @ 2026-05-14 21:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Sean Christopherson

Extend the single-step + INT/ICEBP #DB testcase to verify that DR6.BS==0
on the ICEBP #DB, even when single-step is fully enabled.  Per the SDM:

  The INT1 instruction also uses a one-byte opcode (F1) and generates a
  debug exception (#DB) without setting any bits in DR6.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/debug.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/x86/debug.c b/x86/debug.c
index 09f06ef5..36235370 100644
--- a/x86/debug.c
+++ b/x86/debug.c
@@ -281,11 +281,12 @@ static noinline unsigned long singlestep_with_movss_blocking(void)
 static void report_singlestep_with_movss_blocking_and_icebp(unsigned long start,
 							    const char *usermode)
 {
-	report(n == 4 &&
+	report(n == 5 &&
 	       is_icebp_db(dr6[0]) && db_addr[0] == start &&
-	       is_single_step_db(dr6[1]) && db_addr[1] == start + 6 &&
-	       is_single_step_db(dr6[2]) && db_addr[2] == start + 6 + 1 &&
-	       is_single_step_db(dr6[3]) && db_addr[3] == start + 6 + 1 + 1,
+	       is_icebp_db(dr6[1]) && db_addr[1] == start + 1 &&
+	       is_single_step_db(dr6[2]) && db_addr[2] == start + 1 + 6 &&
+	       is_single_step_db(dr6[3]) && db_addr[3] == start + 1 + 6 + 1 &&
+	       is_single_step_db(dr6[4]) && db_addr[4] == start + 1 + 6 + 1 + 1,
 	       "%sSingle-Step + ICEBP #DB w/ MOVSS blocking", usermode);
 }
 
@@ -311,7 +312,8 @@ static noinline unsigned long singlestep_with_movss_blocking_and_icebp(void)
 		"popf\n\t"
 		"mov %%ax, %%ss\n\t"
 		".byte 0xf1;"
-		"1:and $~(1<<8),%%rax\n\t"
+		"1:.byte 0xf1;"
+		"and $~(1<<8),%%rax\n\t"
 		"push %%rax\n\t"
 		"popf\n\t"
 		"lea 1b(%%rip),%0\n\t"

base-commit: 9eb6c57313060d34f7e5b2ac6f90bb5873bbe2ff
-- 
2.54.0.563.g4f69b47b94-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-14 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 21:12 [kvm-unit-tests PATCH] x86/debug: Verify DR6 is always empty on an INT1/ICEBP #DB Sean Christopherson

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