Skip to content

Commit

Permalink
KVM: x86: Ensure all logical CPUs have consistent reserved cr4 bits
Browse files Browse the repository at this point in the history
Check the current CPU's reserved cr4 bits against the mask calculated
for the boot CPU to ensure consistent behavior across all CPUs.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Jan 21, 2020
1 parent b11306b commit f1cdecf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -9461,6 +9461,13 @@ void kvm_arch_hardware_unsetup(void)

int kvm_arch_check_processor_compat(void)
{
struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());

WARN_ON(!irqs_disabled());

if (kvm_host_cr4_reserved_bits(c) != cr4_reserved_bits)
return -EIO;

return kvm_x86_ops->check_processor_compatibility();
}

Expand Down

0 comments on commit f1cdecf

Please sign in to comment.