On 07/17/2018 12:08 PM, Peter Shier wrote:
"instruction intercept" test for CR8 was moving an uninitialized value from eax into CR8. This could cause kvm_set_cr8 to fail the check against CR8_RESERVED_BITS and generate a #GP. Signed-off-by: Peter Shier <pshier@xxxxxxxxxx> --- x86/vmx_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index f57050eb6308..8f70014dc12d 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -762,7 +762,7 @@ asm( "insn_cr3_load: mov cr3,%rax; mov %rax,%cr3;ret\n\t" "insn_cr3_store: mov %cr3,%rax;ret\n\t" #ifdef __x86_64__ - "insn_cr8_load: mov %rax,%cr8;ret\n\t" + "insn_cr8_load: xor %eax, %eax; mov %rax,%cr8;ret\n\t" "insn_cr8_store: mov %cr8,%rax;ret\n\t" #endif "insn_monitor: xor %eax, %eax; xor %ecx, %ecx; xor %edx, %edx; monitor;ret\n\t"
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>