]> git.baikalelectronics.ru Git - kernel.git/commit
KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 23 Aug 2017 21:16:29 +0000 (23:16 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Aug 2017 07:28:37 +0000 (09:28 +0200)
commit8dab45c85c300b369cd8a414f2270fe50c55bdb7
treea6f60166609560bc722887d8449872599a2498bf
parent7296b27b95848f615b6b197316f21ad52564d0c4
KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state

The host pkru is restored right after vcpu exit (commit 2e207fd), so
KVM_GET_XSAVE will return the host PKRU value instead.  Fix this by
using the guest PKRU explicitly in fill_xsave and load_xsave.  This
part is based on a patch by Junkang Fu.

The host PKRU data may also not match the value in vcpu->arch.guest_fpu.state,
because it could have been changed by userspace since the last time
it was saved, so skip loading it in kvm_load_guest_fpu.

Reported-by: Junkang Fu <junkang.fjk@alibaba-inc.com>
Cc: Yang Zhang <zy107165@alibaba-inc.com>
Fixes: 2e207fd9671b95fbc2ce770e7a38efedd745a5b1
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/fpu/internal.h
arch/x86/kvm/x86.c