]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
kvm: fix schedule in atomic in kvm_steal_time_set_preempted()
authorAndrea Arcangeli <aarcange@redhat.com>
Sat, 17 Dec 2016 17:43:52 +0000 (18:43 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 19 Dec 2016 14:45:14 +0000 (15:45 +0100)
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 <aarcange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c

index 49da1064ef5073736ba712a6cdce0146414abd20..8ce1139a08b5319f5f84b58dfc35b32518c20de9 100644 (file)
@@ -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();