Skip to content

Commit 28f091b

Browse files
committed
KVM: MMU: shadow nested paging does not have PKU
Initialize the mask for PKU permissions as if CR4.PKE=0, avoiding incorrect interpretations of the nested hypervisor's page tables. Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4b85c92 commit 28f091b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,7 +4855,7 @@ void kvm_init_shadow_npt_mmu(struct kvm_vcpu *vcpu, unsigned long cr0,
48554855
struct kvm_mmu *context = &vcpu->arch.guest_mmu;
48564856
struct kvm_mmu_role_regs regs = {
48574857
.cr0 = cr0,
4858-
.cr4 = cr4,
4858+
.cr4 = cr4 & ~X86_CR4_PKE,
48594859
.efer = efer,
48604860
};
48614861
union kvm_mmu_role new_role;
@@ -4919,7 +4919,7 @@ void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly,
49194919
context->direct_map = false;
49204920

49214921
update_permission_bitmask(context, true);
4922-
update_pkru_bitmask(context);
4922+
context->pkru_mask = 0;
49234923
reset_rsvds_bits_mask_ept(vcpu, context, execonly);
49244924
reset_ept_shadow_zero_bits_mask(vcpu, context, execonly);
49254925
}

0 commit comments

Comments
 (0)