linux-stable/tools/testing/selftests/kvm/x86_64
Vitaly Kuznetsov ef40598098 selftests: kvm: fix sync_regs_test with newer gccs
Commit 204c91eff7 ("KVM: selftests: do not blindly clobber registers in
 guest asm") was intended to make test more gcc-proof, however, the result
is exactly the opposite: on newer gccs (e.g. 8.2.1) the test breaks with

==== Test Assertion Failure ====
  x86_64/sync_regs_test.c:168: run->s.regs.regs.rbx == 0xBAD1DEA + 1
  pid=14170 tid=14170 - Invalid argument
     1	0x00000000004015b3: main at sync_regs_test.c:166 (discriminator 6)
     2	0x00007f413fb66412: ?? ??:0
     3	0x000000000040191d: _start at ??:?
  rbx sync regs value incorrect 0x1.

Apparently, compile is still free to play games with registers even
when they have variables attached.

Re-write guest code with 'asm volatile' by embedding ucall there and
making sure rbx is preserved.

Fixes: 204c91eff7 ("KVM: selftests: do not blindly clobber registers in guest asm")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-22 13:31:18 +02:00
..
cr4_cpuid_sync_test.c KVM: selftests: Compile code with warnings enabled 2019-05-24 21:27:05 +02:00
evmcs_test.c selftests: kvm: provide common function to enable eVMCS 2019-08-15 09:16:02 +02:00
hyperv_cpuid.c KVM: selftests: hyperv_cpuid: add check for NoNonArchitecturalCoreSharing bit 2019-09-24 13:37:31 +02:00
mmio_warning_test.c tests: kvm: Check for a kernel warning 2019-06-19 16:11:54 +02:00
platform_info_test.c selftests/kvm: make platform_info_test pass on AMD 2019-08-21 19:08:18 +02:00
set_sregs_test.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482 2019-06-19 17:09:52 +02:00
smm_test.c kvm: selftests: hide vcpu_setup in processor code 2019-06-05 14:12:02 +02:00
state_test.c KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
sync_regs_test.c selftests: kvm: fix sync_regs_test with newer gccs 2019-10-22 13:31:18 +02:00
vmx_close_while_nested_test.c selftests: kvm: consolidate VMX support checks 2019-10-22 13:31:16 +02:00
vmx_dirty_log_test.c selftests: kvm: vmx_dirty_log_test: skip the test when VMX is not supported 2019-10-22 13:31:17 +02:00
vmx_set_nested_state_test.c selftests: kvm: consolidate VMX support checks 2019-10-22 13:31:16 +02:00
vmx_tsc_adjust_test.c selftests: kvm: consolidate VMX support checks 2019-10-22 13:31:16 +02:00