]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KVM: Register /dev/kvm as the _very_ last thing during initialization
authorSean Christopherson <seanjc@google.com>
Wed, 30 Nov 2022 23:08:45 +0000 (23:08 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:47:25 +0000 (16:47 +0100)
commitf141995071a45f9aad51a10ec4ad39212e374fe7
tree6aa826ee860fec14039f4a0b8a81fafe938e1d6f
parent944a5c378e472593522b7e85fa36b694e78cd2b1
KVM: Register /dev/kvm as the _very_ last thing during initialization

BugLink: https://bugs.launchpad.net/bugs/2011425
commit 2b01281273738bf2d6551da48d65db2df3f28998 upstream.

Register /dev/kvm, i.e. expose KVM to userspace, only after all other
setup has completed.  Once /dev/kvm is exposed, userspace can start
invoking KVM ioctls, creating VMs, etc...  If userspace creates a VM
before KVM is done with its configuration, bad things may happen, e.g.
KVM will fail to properly migrate vCPU state if a VM is created before
KVM has registered preemption notifiers.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221130230934.1014142-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
virt/kvm/kvm_main.c