kvm: x86: fix RSM when PCID is non-zero
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 20 Dec 2017 23:49:14 +0000 (00:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Dec 2017 16:43:00 +0000 (17:43 +0100)
commit18276e9bcd49d5d4bcbdbf41901a9dd996fdb1a7
tree3c84a5a8ab2ab8ec4cfef93616ad2f16e882e2a8
parente5c73b3b60e1b8d645749e0bdc93104ae6fa01f5
kvm: x86: fix RSM when PCID is non-zero

commit fae1a3e775cca8c3a9e0eb34443b310871a15a92 upstream.

rsm_load_state_64() and rsm_enter_protected_mode() load CR3, then
CR4 & ~PCIDE, then CR0, then CR4.

However, setting CR4.PCIDE fails if CR3[11:0] != 0.  It's probably easier
in the long run to replace rsm_enter_protected_mode() with an emulator
callback that sets all the special registers (like KVM_SET_SREGS would
do).  For now, set the PCID field of CR3 only after CR4.PCIDE is 1.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Fixes: 660a5d517aaab9187f93854425c4c63f4a09195c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/emulate.c