summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorChenyi Qiang <chenyi.qiang@intel.com>2021-10-21 15:10:22 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-27 09:59:49 +0200
commitdfcc47a1fe36d5508f502676ae387086c0e490e3 (patch)
tree7a5e6b11a4983605364529e2a950e8961e85dcb9 /arch
parente647d75565ab47d4339c18c45cbde1488936463e (diff)
KVM: MMU: Reset mmu->pkru_mask to avoid stale data
commit a3ca5281bb771d8103ea16f0a6a8a5df9a7fb4f3 upstream. When updating mmu->pkru_mask, the value can only be added but it isn't reset in advance. This will make mmu->pkru_mask keep the stale data. Fix this issue. Fixes: 2d344105f57c ("KVM, pkeys: introduce pkru_mask to cache conditions") Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com> Message-Id: <20211021071022.1140-1-chenyi.qiang@intel.com> Reviewed-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu/mmu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index c268fb59f779..6719a8041f59 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4465,10 +4465,10 @@ static void update_pkru_bitmask(struct kvm_mmu *mmu)
unsigned bit;
bool wp;
- if (!is_cr4_pke(mmu)) {
- mmu->pkru_mask = 0;
+ mmu->pkru_mask = 0;
+
+ if (!is_cr4_pke(mmu))
return;
- }
wp = is_cr0_wp(mmu);