Skip to contentSkip to conversation

Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs"

PATCH Applied Jan Kiszka 2 participants 2 messages Jul 1, 2009 – Jul 6, 2009

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs"

This reverts commit 6c20e1442bb1c62914bb85b7f4a38973d2a423ba.

To my understanding, it became obsolete with the advent of the more robust check in mmu_alloc_roots (89da4ff17f). Moreover, it prevents the conceptually safe pattern

1. set sregs
2. register mem-slots
3. run vcpu

by setting a sticky triple fault during step 1.

---

 arch/x86/kvm/x86.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
arch/x86/kvm/x86.c +1 -7
index af53f64..8c5f7ef 100644
@@ -4355,13 +4355,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 
 	vcpu->arch.cr2 = sregs->cr2;
 	mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3;
-
-	down_read(&vcpu->kvm->slots_lock);
-	if (gfn_to_memslot(vcpu->kvm, sregs->cr3 >> PAGE_SHIFT))
-		vcpu->arch.cr3 = sregs->cr3;
-	else
-		set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
-	up_read(&vcpu->kvm->slots_lock);
+	vcpu->arch.cr3 = sregs->cr3;
 
 	kvm_set_cr8(vcpu, sregs->cr8);
 
Applied
#1 lore raw
Quoted 6 lines · Jan Kiszka

This reverts commit 6c20e1442bb1c62914bb85b7f4a38973d2a423ba.

To my understanding, it became obsolete with the advent of the more robust check in mmu_alloc_roots (89da4ff17f). Moreover, it prevents the conceptually safe pattern

Quoted 7 lines

1. set sregs
2. register mem-slots
3. run vcpu

by setting a sticky triple fault during step 1.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function