]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: prevent setting unsupported XSAVE states
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Oct 2013 14:06:15 +0000 (16:06 +0200)
committerGleb Natapov <gleb@redhat.com>
Thu, 3 Oct 2013 09:29:07 +0000 (12:29 +0300)
commit247f32e1a8e3cf0895351bf4acb036debce2502e
tree33e0f69e36fd042139eb490745515c466a1685d2
parentfc04cf9dbbe769e5b691c0d7b7d38fe6b0653b0c
KVM: x86: prevent setting unsupported XSAVE states

A guest can still attempt to save and restore XSAVE states even if they
have been masked in CPUID leaf 0Dh.  This usually is not visible to
the guest, but is still wrong: "Any attempt to set a reserved bit (as
determined by the contents of EAX and EDX after executing CPUID with
EAX=0DH, ECX= 0H) in XCR0 for a given processor will result in a #GP
exception".

The patch also performs the same checks as __kvm_set_xcr in KVM_SET_XSAVE.
This catches migration from newer to older kernel/processor before the
guest starts running.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/x86.c