lkml.org 
[lkml]   [2010]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/27] KVM: MMU: Add infrastructure for two-level page walker
  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.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.



\
 
 \ /
  Last update: 2010-09-06 20:09    [W:0.239 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site