kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
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	[thread overview]
Message-ID: <1503523566-25624-1-git-send-email-pbonzini@redhat.com> (raw)

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

             reply	other threads:[~2017-08-23 21:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 21:26 Paolo Bonzini [this message]
2017-08-23 21:26 ` [PATCH 1/2] KVM: x86: simplify handling of PKRU Paolo Bonzini
2017-08-24  9:09   ` Yang Zhang
2017-08-24  9:19     ` Paolo Bonzini
2017-08-24 10:05       ` Yang Zhang
2017-08-24 10:14         ` Paolo Bonzini
2017-08-23 21:26 ` [PATCH 2/2] KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503523566-25624-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=junkang.fjk@alibaba-inc.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yang.zhang.wz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).