selftests: kvm: Fix assert failure in single-step test
PATCH 1/1 selftests: kvm: Fix assert failure in single-step test
This is a follow-up patch to fix an issue left in commit:98b0bf02738004829d7e26d6cb47b2e469aaba86
selftests: kvm: Use a shorter encoding to clear RAX
With the change in the commit, we also need to modify "xor" instruction length from 3 to 2 in array ss_size accordingly to pass below check:
for (i = 0; i < (sizeof(ss_size) / sizeof(ss_size[0])); i++) {
target_rip += ss_size[i];
CLEAR_DEBUG();
debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
debug.arch.debugreg[7] = 0x00000400;
APPLY_DEBUG();
vcpu_run(vm, VCPU_ID);
TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
run->debug.arch.exception == DB_VECTOR &&
run->debug.arch.pc == target_rip &&
run->debug.arch.dr6 == target_dr6,
"SINGLE_STEP[%d]: exit %d exception %d rip 0x%llx "
"(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
i, run->exit_reason, run->debug.arch.exception,
run->debug.arch.pc, target_rip, run->debug.arch.dr6,
target_dr6);
}Reported-by kernel test robot <[email protected]>
Signed-off-by Yang Weijiang <[email protected]>
--- tools/testing/selftests/kvm/x86_64/debug_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/x86_64/debug_regs.c +1 -1
@@ -73,7 +73,7 @@ int main(void)int i;/* Instruction lengths starting at ss_start */ int ss_size[4 ] = { -3 ,/* xor */ +2 ,/* xor */ 2 ,/* cpuid */ 5 ,/* mov */ 2 ,/* rdmsr */
Signature · 1 line
2.17.2
Quoted 37 lines · Yang Weijiang
This is a follow-up patch to fix an issue left in commit:
98b0bf02738004829d7e26d6cb47b2e469aaba86
selftests: kvm: Use a shorter encoding to clear RAXWith the change in the commit, we also need to modify "xor" instruction length from 3 to 2 in array
ss_sizeaccordingly to pass below check:for (i = 0; i < (sizeof(ss_size) / sizeof(ss_size[0])); i++) { target_rip += ss_size[i]; CLEAR_DEBUG(); debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP; debug.arch.debugreg[7] = 0x00000400; APPLY_DEBUG(); vcpu_run(vm, VCPU_ID); TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG && run->debug.arch.exception == DB_VECTOR && run->debug.arch.pc == target_rip && run->debug.arch.dr6 == target_dr6, "SINGLE_STEP[%d]: exit %d exception %d rip 0x%llx " "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)", i, run->exit_reason, run->debug.arch.exception, run->debug.arch.pc, target_rip, run->debug.arch.dr6, target_dr6); }Reported-by kernel test robot <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- tools/testing/selftests/kvm/x86_64/debug_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/kvm/x86_64/debug_regs.c +0
-0
tools/testing/selftests/kvm/x86_64/debug_regs.c int main(void) · line 79
Quoted 8 lines
tools/testing/selftests/kvm/x86_64/debug_regs.c +1
-1@@ -73,7 +73,7 @@ int main(void)int i;/* Instruction lengths starting at ss_start */ int ss_size[4 ] = { -3 ,/* xor */ +2 ,/* xor */ 2 ,/* cpuid */ 5 ,/* mov */ 2 ,/* rdmsr */
Queued, thanks.
Paolo