Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8184dd38 authored by Avi Kivity's avatar Avi Kivity
Browse files

KVM: MMU: Allow spte.w=1 for gpte.w=0 and cr0.wp=0 only in shadow mode



When tdp is enabled, the guest's cr0.wp shouldn't have any effect on spte
permissions.

Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 10ab25cd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1882,7 +1882,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
	spte |= (u64)pfn << PAGE_SHIFT;

	if ((pte_access & ACC_WRITE_MASK)
	    || (write_fault && !is_write_protection(vcpu) && !user_fault)) {
	    || (!tdp_enabled && write_fault && !is_write_protection(vcpu)
		&& !user_fault)) {

		if (level > PT_PAGE_TABLE_LEVEL &&
		    has_wrprotected_page(vcpu->kvm, gfn, level)) {