Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdH1CuR (ORCPT ); Sun, 27 Aug 2017 22:50:17 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:36613 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbdH1CuP (ORCPT ); Sun, 27 Aug 2017 22:50:15 -0400 Subject: Re: [PATCH 0/3] KVM, pkeys: fix handling of PKRU across migration To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: junkang.fjk@alibaba-inc.com References: <1503569573-55057-1-git-send-email-pbonzini@redhat.com> From: Yang Zhang Message-ID: Date: Mon, 28 Aug 2017 10:50:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1503569573-55057-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1389 Lines: 43 On 2017/8/24 18:12, Paolo Bonzini wrote: > 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. > > Series as follows: > > 1) fix independent bug which would cause an oops > > 2) remove an unnecessary abstraction > > 3) fix the bug > > Please test the patches, as I don't have the affected hardware. Note > that I need the results before tomorrow in order to send these patches > to Linus before going on vacation. > > Thanks, > > Paolo > > > Paolo Bonzini (3): > KVM: x86: block guest protection keys unless the host has them enabled > 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/cpuid.c | 2 +- > 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 | 25 ++++++++----------------- > arch/x86/kvm/x86.c | 17 ++++++++++++++--- > 8 files changed, 28 insertions(+), 37 deletions(-) > Reviewed-by: Yang Zhang -- Yang Alibaba Cloud Computing