Re: [PATCH 3/8] KVM: Activate fpu on clts

Gleb Natapov
2010-02-03T10:23:57Z

On Tue, Feb 02, 2010 at 09:16:44AM +0100, Paolo Bonzini wrote:
> On 01/21/2010 02:31 PM, Avi Kivity wrote:
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index feca59f..09207ba 100644
> >--- a/arch/x86/kvm/x86.c
> >+++ b/arch/x86/kvm/x86.c
> >@@ -3266,6 +3266,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
> > int emulate_clts(struct kvm_vcpu *vcpu)
> > {
> > kvm_x86_ops->set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~X86_CR0_TS));
> >+ kvm_x86_ops->fpu_activate(vcpu);
> > return X86EMUL_CONTINUE;
> > }
>
> Can this code be reached if CLTS is executed in real mode? That
> would cause a NULL-pointer access on VMX.
>
We should assume that any part of emulator can be reached from a guest
and do check accordingly.

--
Gleb.