From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH] KVM: MMU: Fix overflow of SHADOW_PT_INDEX with EPT in 32pae Date: Mon, 1 Sep 2008 18:31:05 +0800 Message-ID: <20080901103105.GA10443@yukikaze> References: <200809011732.55508.sheng.yang@intel.com> <48BBB874.5040604@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Yang, Sheng" , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from ti-out-0910.google.com ([209.85.142.185]:9529 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbYIAKbH (ORCPT ); Mon, 1 Sep 2008 06:31:07 -0400 Received: by ti-out-0910.google.com with SMTP id b6so1062467tic.23 for ; Mon, 01 Sep 2008 03:31:05 -0700 (PDT) Content-Disposition: inline In-Reply-To: <48BBB874.5040604@qumranet.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 01, 2008 at 12:40:04PM +0300, Avi Kivity wrote: > Yang, Sheng wrote: >> From: Sheng Yang >> Date: Mon, 1 Sep 2008 17:28:59 +0800 >> Subject: [PATCH] KVM: MMU: Fix overflow of SHADOW_PT_INDEX with EPT in 32pae >> >> EPT is 4 level by default in 32pae (48bits), but virtual address only >> got 32 bits. This result in SHADOW_PT_INDEX() overflow when try to >> fetch level 4 index. >> >> Fix it by extend virtual address to 64bits in any condition. >> >> > > Good catch. > >> Signed-off-by: Sheng Yang >> --- >> arch/x86/kvm/mmu.c | 8 +++++++- >> 1 files changed, 7 insertions(+), 1 deletions(-) >> >> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c >> index f33c594..8ca9aad 100644 >> --- a/arch/x86/kvm/mmu.c >> +++ b/arch/x86/kvm/mmu.c >> @@ -943,6 +943,7 @@ static int walk_shadow(struct kvm_shadow_walk *walker, >> int level; >> int r; >> u64 *sptep; >> + u64 ext_addr = addr; >> > > addr isn't really a gva_t; it is a pga_t when using direct mappings. > > So how about changing walk_shadow() and its callbacks to use u64 instead > of gva_t instead? Yeah, that's better, would update the patch soon. :) -- regards Yang, Sheng > > > -- > error compiling committee.c: too many arguments to function > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html