Skip to content

Commit 1b385cb

Browse files
committed
kvm, vmx: Really fix lazy FPU on nested guest
Commit e504c90 (kvm, vmx: Fix lazy FPU on nested guest, 2013-11-13) highlighted a real problem, but the fix was subtly wrong. nested_read_cr0 is the CR0 as read by L2, but here we want to look at the CR0 value reflecting L1's setup. In other words, L2 might think that TS=0 (so nested_read_cr0 has the bit clear); but if L1 is actually running it with TS=1, we should inject the fault into L1. The effective value of CR0 in L2 is contained in vmcs12->guest_cr0, use it. Fixes: e504c90 Reported-by: Kashyap Chamarty <kchamart@redhat.com> Reported-by: Stefan Bader <stefan.bader@canonical.com> Tested-by: Kashyap Chamarty <kchamart@redhat.com> Tested-by: Anthoine Bourgeois <bourgeois@bertin.fr> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent a08d3b3 commit 1b385cb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/x86/kvm/vmx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6688,7 +6688,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
66886688
else if (is_page_fault(intr_info))
66896689
return enable_ept;
66906690
else if (is_no_device(intr_info) &&
6691-
!(nested_read_cr0(vmcs12) & X86_CR0_TS))
6691+
!(vmcs12->guest_cr0 & X86_CR0_TS))
66926692
return 0;
66936693
return vmcs12->exception_bitmap &
66946694
(1u << (intr_info & INTR_INFO_VECTOR_MASK));

0 commit comments

Comments
 (0)