OSDN Git Service

KVM: x86: Supplement __cr4_reserved_bits() with X86_FEATURE_PCID check
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 1 Feb 2021 14:28:43 +0000 (15:28 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Feb 2021 17:43:02 +0000 (12:43 -0500)
commit4683d758f48e6ae87d3d3493ffa00aceb955ee16
treed42c76d5bd14b6e012ec21f00d660acc663b7499
parentb66f9bab1279c281c83dea077c5e808527e3ef69
KVM: x86: Supplement __cr4_reserved_bits() with X86_FEATURE_PCID check

Commit 7a873e455567 ("KVM: selftests: Verify supported CR4 bits can be set
before KVM_SET_CPUID2") reveals that KVM allows to set X86_CR4_PCIDE even
when PCID support is missing:

==== Test Assertion Failure ====
  x86_64/set_sregs_test.c:41: rc
  pid=6956 tid=6956 - Invalid argument
     1 0x000000000040177d: test_cr4_feature_bit at set_sregs_test.c:41
     2 0x00000000004014fc: main at set_sregs_test.c:119
     3 0x00007f2d9346d041: ?? ??:0
     4 0x000000000040164d: _start at ??:?
  KVM allowed unsupported CR4 bit (0x20000)

Add X86_FEATURE_PCID feature check to __cr4_reserved_bits() to make
kvm_is_valid_cr4() fail.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20210201142843.108190-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.h