[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100908092013.GK2177@amd.com>
Date: Wed, 8 Sep 2010 11:20:14 +0200
From: "Roedel, Joerg" <Joerg.Roedel@....com>
To: Avi Kivity <avi@...hat.com>
CC: Marcelo Tosatti <mtosatti@...hat.com>,
Alexander Graf <agraf@...e.de>,
"joro@...tes.org" <joro@...tes.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 10/27] KVM: MMU: Add infrastructure for two-level page
walker
On Mon, Sep 06, 2010 at 02:05:35PM -0400, Avi Kivity wrote:
> On 09/06/2010 06:55 PM, Joerg Roedel wrote:
> > This patch introduces a mmu-callback to translate gpa
> > addresses in the walk_addr code. This is later used to
> > translate l2_gpa addresses into l1_gpa addresses.
>
> > @@ -534,6 +534,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
> > return (gpa_t)gfn<< PAGE_SHIFT;
> > }
> >
> > +static inline gfn_t gpa_to_gfn(gpa_t gpa)
> > +{
> > + return (gfn_t)gpa>> PAGE_SHIFT;
> > +}
> > +
>
> That's a bug - gfn_t may be smaller than gpa_t, so you're truncating
> just before the shift. Note the casts in the surrounding functions are
> widening, not narrowing.
>
> However, gfn_t is u64 so the bug is only theoretical.
Will fix that in v4 too. Thanks.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists