Skip to content

Commit

Permalink
kvm: fix schedule in atomic in kvm_steal_time_set_preempted()
Browse files Browse the repository at this point in the history
kvm_steal_time_set_preempted() isn't disabling the pagefaults before
calling __copy_to_user and the kernel debug notices.

Signed-off-by: Andrea Arcangeli <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
aagit authored and bonzini committed Dec 19, 2016
1 parent 3f5ad8b commit 931f261
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,17 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)

void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
{
/*
* Disable page faults because we're in atomic context here.
* kvm_write_guest_offset_cached() would call might_fault()
* that relies on pagefault_disable() to tell if there's a
* bug. NOTE: the write to guest memory may not go through if
* during postcopy live migration or if there's heavy guest
* paging.
*/
pagefault_disable();
kvm_steal_time_set_preempted(vcpu);
pagefault_enable();
kvm_x86_ops->vcpu_put(vcpu);
kvm_put_guest_fpu(vcpu);
vcpu->arch.last_host_tsc = rdtsc();
Expand Down

0 comments on commit 931f261

Please sign in to comment.