Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751152AbdHWV0N (ORCPT ); Wed, 23 Aug 2017 17:26:13 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36251 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbdHWV0L (ORCPT ); Wed, 23 Aug 2017 17:26:11 -0400 From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: junkang.fjk@alibaba-inc.com, yang.zhang.wz@gmail.com Subject: [PATCH 0/2] KVM, pkeys: fix handling of PKRU across migration Date: Wed, 23 Aug 2017 23:26:04 +0200 Message-Id: <1503523566-25624-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 905 Lines: 26 The host pkru is restored right after vcpu exit (commit 1be0e61), so KVM_GET_XSAVE will return the host PKRU value instead. In general, the PKRU value in vcpu->arch.guest_fpu.state cannot be trusted. The first patch removes an unnecessary abstraction. The second fixes the bug. Please test the patches, as I don't have the affected hardware. Paolo Paolo Bonzini (2): KVM: x86: simplify handling of PKRU KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state arch/x86/include/asm/fpu/internal.h | 6 +++--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/kvm_cache_regs.h | 5 ----- arch/x86/kvm/mmu.h | 2 +- arch/x86/kvm/svm.c | 7 ------- arch/x86/kvm/vmx.c | 23 ++++++----------------- arch/x86/kvm/x86.c | 17 ++++++++++++++--- 7 files changed, 25 insertions(+), 36 deletions(-) -- 1.8.3.1