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

Re: [Xen-devel] [PATCH] Domain core-dumping fixes



On Wed, Mar 11, 2009 at 06:45:49PM -0700, John Levon wrote:
> diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
> --- a/tools/libxc/xc_core.c
> +++ b/tools/libxc/xc_core.c
> @@ -518,7 +518,17 @@ xc_domain_dumpcore_via_callback(int xc_h
>      if ( sts != 0 )
>          goto out;
>  
> +    /*
> +     * Note: this is the *current* number of pages and may change under
> +     * a live dump-core.  We'll just take this value, and if more pages
> +     * exist, we'll skip them.  If there's less, then we'll just not use
> +     * all the array...
> +     *
> +     * We don't want to use the total potential size of the memory map
> +     * since that is usually much higher than info.nr_pages.
> +     */
>      nr_pages = info.nr_pages;
> +
>      if ( !auto_translated_physmap )
>      {
>          /* obtain p2m table */
> @@ -770,7 +780,7 @@ xc_domain_dumpcore_via_callback(int xc_h
>  
>          pfn_start = memory_map[map_idx].addr >> PAGE_SHIFT;
>          pfn_end = pfn_start + (memory_map[map_idx].size >> PAGE_SHIFT);
> -        for ( i = pfn_start; i < pfn_end; i++ )
> +        for ( i = pfn_start; i < pfn_end && j < nr_pages; i++ )
>          {
>              uint64_t gmfn;
>              void *vaddr;

Did the issue really happen?
I believe the following if clause handles the case. or j orverflowed?

        pfn_start = memory_map[map_idx].addr >> PAGE_SHIFT;
        pfn_end = pfn_start + (memory_map[map_idx].size >> PAGE_SHIFT);
        for ( i = pfn_start; i < pfn_end; i++ )
        {
            uint64_t gmfn;
            void *vaddr;
            
            if ( j >= nr_pages ) <<<<<<<<<<<<<< HERE! >>>>>>>>>>>>>>>>
            {
                /*
                 * When live dump-mode (-L option) is specified,
                 * guest domain may increase memory.
                 */
                IPRINTF("exceeded nr_pages (%ld) losing pages", nr_pages);
                goto copy_done;
            }


-- 
yamahata

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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