diff options
author | Avi Kivity <avi@qumranet.com> | 2007-06-14 15:27:40 +0200 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-06-15 11:30:59 +0200 |
commit | 7702fd1f6fea57921f2e643d27a23a2d0394499c (patch) | |
tree | 9a5275fb2f5eaccc491bfe5d9617c3da7f69aa5a /drivers/kvm/vmx.c | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fix (diff) | |
download | linux-7702fd1f6fea57921f2e643d27a23a2d0394499c.tar.xz linux-7702fd1f6fea57921f2e643d27a23a2d0394499c.zip |
KVM: Prevent guest fpu state from leaking into the host
The lazy fpu changes did not take into account that some vmexit handlers
can sleep. Move loading the guest state into the inner loop so that it
can be reloaded if necessary, and move loading the host state into
vmx_vcpu_put() so it can be performed whenever we relinquish the vcpu.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/kvm/vmx.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 184238e2ece4..c1ac106ace8c 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -280,6 +280,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu) static void vmx_vcpu_put(struct kvm_vcpu *vcpu) { + kvm_put_guest_fpu(vcpu); put_cpu(); } @@ -1847,10 +1848,8 @@ again: if (vcpu->guest_debug.enabled) kvm_guest_debug_pre(vcpu); - if (vcpu->fpu_active) { - fx_save(vcpu->host_fx_image); - fx_restore(vcpu->guest_fx_image); - } + kvm_load_guest_fpu(vcpu); + /* * Loading guest fpu may have cleared host cr0.ts */ @@ -2012,11 +2011,6 @@ again: } #endif - if (vcpu->fpu_active) { - fx_save(vcpu->guest_fx_image); - fx_restore(vcpu->host_fx_image); - } - vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0; asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); |