Skip to content

Commit a3ca528

Browse files
Qiangcybonzini
authored andcommitted
KVM: MMU: Reset mmu->pkru_mask to avoid stale data
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: 2d34410 ("KVM, pkeys: introduce pkru_mask to cache conditions") Signed-off-by: Chenyi Qiang <[email protected]> Message-Id: <[email protected]> Reviewed-by: Sean Christopherson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 3a25dfa commit a3ca528

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4596,10 +4596,10 @@ static void update_pkru_bitmask(struct kvm_mmu *mmu)
45964596
unsigned bit;
45974597
bool wp;
45984598

4599-
if (!is_cr4_pke(mmu)) {
4600-
mmu->pkru_mask = 0;
4599+
mmu->pkru_mask = 0;
4600+
4601+
if (!is_cr4_pke(mmu))
46014602
return;
4602-
}
46034603

46044604
wp = is_cr0_wp(mmu);
46054605

0 commit comments

Comments
 (0)