]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 17 Jan 2022 15:05:40 +0000 (16:05 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 17 Jan 2022 17:29:41 +0000 (12:29 -0500)
commit1fadf0d692285bad3274021dd5d791ffa4b3b294
tree0600727b137c2b9cd3b5096bfb7b205e6f522277
parent6726e065e7bd9d28c6db5f9e2e15bd120ab44f8d
KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN

Commit 991999ba959f ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN")
forbade changing CPUID altogether but unfortunately this is not fully
compatible with existing VMMs. In particular, QEMU reuses vCPU fds for
CPU hotplug after unplug and it calls KVM_SET_CPUID2. Instead of full ban,
check whether the supplied CPUID data is equal to what was previously set.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Fixes: 991999ba959f ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220117150542.2176196-3-vkuznets@redhat.com>
Cc: stable@vger.kernel.org
[Do not call kvm_find_cpuid_entry repeatedly. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/x86.c