Skip to content

Commit d76c7fb

Browse files
Sean Christophersonbonzini
authored andcommitted
KVM: x86: Mark CR4.UMIP as reserved based on associated CPUID bit
Re-add code to mark CR4.UMIP as reserved if UMIP is not supported by the host. The UMIP handling was unintentionally dropped during a recent refactoring. Not flagging CR4.UMIP allows the guest to set its CR4.UMIP regardless of host support or userspace desires. On CPUs with UMIP support, including emulated UMIP, this allows the guest to enable UMIP against the wishes of the userspace VMM. On CPUs without any form of UMIP, this results in a failed VM-Enter due to invalid guest state. Fixes: 345599f ("KVM: x86: Add macro to ensure reserved cr4 bits checks stay in sync") Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent bcfcff6 commit d76c7fb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,8 @@ EXPORT_SYMBOL_GPL(kvm_set_xcr);
898898
__reserved_bits |= X86_CR4_PKE; \
899899
if (!__cpu_has(__c, X86_FEATURE_LA57)) \
900900
__reserved_bits |= X86_CR4_LA57; \
901+
if (!__cpu_has(__c, X86_FEATURE_UMIP)) \
902+
__reserved_bits |= X86_CR4_UMIP; \
901903
__reserved_bits; \
902904
})
903905

0 commit comments

Comments
 (0)