summaryrefslogtreecommitdiff
path: root/kvm_mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kvm_mmu.c')
-rw-r--r--kvm_mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kvm_mmu.c b/kvm_mmu.c
index 3895196..58f6fe8 100644
--- a/kvm_mmu.c
+++ b/kvm_mmu.c
@@ -1659,6 +1659,9 @@ set_spte(struct kvm_vcpu *vcpu, uint64_t *sptep, unsigned pte_access,
spte |= PT_WRITABLE_MASK;
+ if (!tdp_enabled && !(pte_access & ACC_WRITE_MASK))
+ spte &= ~PT_USER_MASK;
+
/*
* Optimization: for pte sync, if spte was writable the hash
* lookup is unnecessary (and expensive). Write protection