From patchwork Wed Jul 1 18:52:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 33550 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n61IqFNa030551 for ; Wed, 1 Jul 2009 18:52:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753706AbZGASwI (ORCPT ); Wed, 1 Jul 2009 14:52:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753275AbZGASwH (ORCPT ); Wed, 1 Jul 2009 14:52:07 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:46945 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbZGASwG (ORCPT ); Wed, 1 Jul 2009 14:52:06 -0400 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate03.web.de (Postfix) with ESMTP id 71D9C10238210; Wed, 1 Jul 2009 20:52:09 +0200 (CEST) Received: from [92.74.61.159] (helo=[192.168.1.10]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1MM4uf-0003aC-00; Wed, 01 Jul 2009 20:52:09 +0200 Message-ID: <4A4BB053.6010407@web.de> Date: Wed, 01 Jul 2009 20:52:03 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti CC: kvm-devel Subject: [PATCH] Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs" X-Enigmail-Version: 0.95.7 X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX18fRaRX8wX2rLvZeiCEzXDslh5gjBnvWECJS02x Ii/4NMLMvBNojPqK8iee43kxalvl02Nf1VmBDqGIwtNpXRcpQN I4Hmedh8E= Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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. Signed-off-by: Jan Kiszka --- arch/x86/kvm/x86.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index af53f64..8c5f7ef 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -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);