From patchwork Fri Jul 23 05:16:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 113833 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6N5KlnZ024913 for ; Fri, 23 Jul 2010 05:20:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663Ab0GWFUO (ORCPT ); Fri, 23 Jul 2010 01:20:14 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:56950 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752357Ab0GWFUN (ORCPT ); Fri, 23 Jul 2010 01:20:13 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 3AA1417012A; Fri, 23 Jul 2010 13:20:11 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o6N5HIdZ003487; Fri, 23 Jul 2010 13:17:18 +0800 Received: from [10.167.141.99] (unknown [10.167.141.99]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id AE62810C1CB; Fri, 23 Jul 2010 13:20:43 +0800 (CST) Message-ID: <4C492597.2000802@cn.fujitsu.com> Date: Fri, 23 Jul 2010 13:16:07 +0800 From: Xiao Guangrong User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Avi Kivity CC: Marcelo Tosatti , LKML , KVM list Subject: [PATCH] KVM: MMU: fix hugepage mapping corrupt caused by regression Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 23 Jul 2010 05:20:47 +0000 (UTC) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index a09e04c..d9a2742 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -374,13 +374,13 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, shadow_walk_next(&it)) { gfn_t direct_gfn; + validate_direct_spte(vcpu, it.sptep, direct_access); + drop_large_spte(vcpu, it.sptep); if (is_shadow_present_pte(*it.sptep)) continue; - validate_direct_spte(vcpu, it.sptep, direct_access); - direct_gfn = gw->gfn & ~(KVM_PAGES_PER_HPAGE(it.level) - 1); sp = kvm_mmu_get_page(vcpu, direct_gfn, addr, it.level-1,