[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/4] x86: check for canonical address before doing page walks



On 10/10/13 14:55, Jan Beulich wrote:
> ... as there doesn't really exists any valid mapping for them.
>
> Particularly in the case of do_page_walk() this also avoids returning
> non-NULL for such invalid input.
>
> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -73,7 +73,7 @@ void *do_page_walk(struct vcpu *v, unsig
>      l2_pgentry_t l2e, *l2t;
>      l1_pgentry_t l1e, *l1t;
>  
> -    if ( is_hvm_vcpu(v) )
> +    if ( is_hvm_vcpu(v) || !is_canonical_address(addr) )
>          return NULL;
>  
>      l4t = map_domain_page(mfn);
> --- a/xen/arch/x86/x86_64/traps.c
> +++ b/xen/arch/x86/x86_64/traps.c
> @@ -170,6 +170,8 @@ void show_page_walk(unsigned long addr)
>      l1_pgentry_t l1e, *l1t;
>  
>      printk("Pagetable walk from %016lx:\n", addr);
> +    if ( !is_canonical_address(addr) )
> +        return;
>  
>      l4t = map_domain_page(mfn);
>      l4e = l4t[l4_table_offset(addr)];
>

I was intending something a little more like

if ( !is_canonical_address(addr) )
{
    printk(" Not canonical\n");
    return;
}

So it doesn't appear on the console that show_page_walk() got stuck
somewhere.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.