]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Apply runtime updates to current CPUID during KVM_SET_CPUID{,2}
authorSean Christopherson <seanjc@google.com>
Tue, 2 Dec 2025 01:50:48 +0000 (17:50 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:21 +0000 (12:57 +0100)
commitcaf68b6da38957e78c8d83df4553542102366449
tree5e3abd7a691b01d0ca360ad7bc88fb472bb0aee2
parentaedf238216636cd10de024f79b6b151a3148bfe9
KVM: x86: Apply runtime updates to current CPUID during KVM_SET_CPUID{,2}

commit e2b43fb25243d502ad36b07bab9de09f4b76fff9 upstream.

When handling KVM_SET_CPUID{,2}, do runtime CPUID updates on the vCPU's
current CPUID (and caps) prior to swapping in the incoming CPUID state so
that KVM doesn't lose pending updates if the incoming CPUID is rejected,
and to prevent a false failure on the equality check.

Note, runtime updates are unconditionally performed on the incoming/new
CPUID (and associated caps), i.e. clearing the dirty flag won't negatively
affect the new CPUID.

Fixes: 93da6af3ae56 ("KVM: x86: Defer runtime updates of dynamic CPUID bits until CPUID emulation")
Reported-by: Igor Mammedov <imammedo@redhat.com>
Closes: https://lore.kernel.org/all/20251128123202.68424a95@imammedo
Cc: stable@vger.kernel.org
Acked-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Link: https://patch.msgid.link/20251202015049.1167490-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/cpuid.c