[Crash-utility] [PATCH] Fix overflow problem of "kmem -p" on i386 SPARSEMEM

Dave Anderson anderson at redhat.com
Tue Nov 13 14:01:26 UTC 2007


Ken'ichi Ohmichi wrote:
> Hi,
> 
> This patch fixes the overflow problem that "kmem -p" cannot display
> the physical addresses properly on i386 SPARSEMEM kernel.
> 
> Before applying this patch:
>   crash> kmem -p
>     PAGE    PHYSICAL   MAPPING    INDEX CNT FLAGS
>   [snip]
>   cb000260  ffffb000   -------    -----   1 e000400
>   cb000280  ffffc000   -------    -----   1 e000400
>   cb0002a0  ffffd000   -------    -----   1 e000400
>   cb0002c0  ffffe000   -------    -----   1 e000400
>   cb0002e0  fffff000   -------    -----   1 e000400
>   cb000400         0   -------    -----   0 12080000
>   cb000420      1000   -------    -----   0 12000000
>   cb000440      2000   -------    -----   0 12000000
>   cb000460      3000   -------    -----   0 12000000
>   cb000480      4000   -------    -----   0 12000000
> 
> After applying this patch:
>   crash> kmem -p
>     PAGE    PHYSICAL   MAPPING    INDEX CNT FLAGS
>   [snip]
>   cb000260  ffffb000   -------    -----   1 e000400
>   cb000280  ffffc000   -------    -----   1 e000400
>   cb0002a0  ffffd000   -------    -----   1 e000400
>   cb0002c0  ffffe000   -------    -----   1 e000400
>   cb0002e0  fffff000   -------    -----   1 e000400
>   cb000400  100000000   -------    -----   0 12080000
>   cb000420  100001000   -------    -----   0 12000000
>   cb000440  100002000   -------    -----   0 12000000
>   cb000460  100003000   -------    -----   0 12000000
>   cb000480  100004000   -------    -----   0 12000000
> 
> 
> This problem can be reproduced on the following environment:
> The crash utility:
>   crash-4.0-4.8
>   + [PATCH] display information about "struct page" on SPARSEMEM.(2007/11/02)
> System:
>   CPU: i386
>   MEM: 4GB or bigger
> Kernel:
>   i386, PAE, SPARSEMEM
> 
> 
> Thanks
> Ken'ichi Ohmichi
> 
> Signed-off-by: Ken'ichi Ohmichi <oomichi at mxs.nes.nec.co.jp>
> ---
> diff -rpuN crash-4.0-4.8.org/memory.c crash-4.0-4.8/memory.c
> --- crash-4.0-4.8.org/memory.c	2007-10-31 11:49:16.000000000 +0900
> +++ crash-4.0-4.8/memory.c	2007-11-13 15:48:31.000000000 +0900
> @@ -4004,7 +4004,7 @@ dump_mem_map_SPARSEMEM(struct meminfo *m
>  
>  		pp = section_mem_map_addr(section);
>  		pp = sparse_decode_mem_map(pp, section_nr);
> -		phys = section_nr * PAGES_PER_SECTION() * PAGESIZE();
> +		phys = (physaddr_t) section_nr * PAGES_PER_SECTION() * PAGESIZE();
>  		section_size = PAGES_PER_SECTION();
>  
>  		for (i = 0; i < section_size; 
> _

Nice catch -- queued for the next release.

Thanks,
   Dave






More information about the Crash-utility mailing list