KVM, pkeys: save/restore PKRU when guest/host switches
authorXiao Guangrong <guangrong.xiao@linux.intel.com>
Tue, 22 Mar 2016 08:51:18 +0000 (16:51 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Mar 2016 15:21:06 +0000 (16:21 +0100)
commit1be0e61c1f255faaeab04a390e00c8b9b9042870
treefc4a8f06af57bff2529a55dafc7918289827683e
parent9e90199c25aec31b4509213881511948f6c763c8
KVM, pkeys: save/restore PKRU when guest/host switches

Currently XSAVE state of host is not restored after VM-exit and PKRU
is managed by XSAVE so the PKRU from guest is still controlling the
memory access even if the CPU is running the code of host. This is
not safe as KVM needs to access the memory of userspace (e,g QEMU) to
do some emulation.

So we save/restore PKRU when guest/host switches.

Signed-off-by: Huaitong Han <huaitong.han@intel.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c