[Crash-utility] Fix fill_mem_map_cache() to read page-size-or-less size correctly
Dave Anderson
anderson at redhat.com
Fri Aug 30 23:54:21 UTC 2019
Hi Kazu,
I will be out of the office until Monday September 16th. I will check
out your patch when I get back.
Thanks,
Dave
----- Original Message -----
>
> fill_mem_map_cache() intends to read page-size-or-less size if it cannot
> read the whole cache size, but it seems it doesn't correctly, and shows
> just zero for existing data.
>
> crash> kmem -p 1000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0000000040 1000 0 0 0 0
> crash> rd ffffea0000000040
> ffffea0000000040: 000fffff00000400 ........
>
> I think the size below should be cnt, and confirmed that the patch works
> well with a dump by makedumpfile -e option.
>
> Signed-off-by: Kazuhito Hagio <k-hagio at ab.jp.nec.com>
> ---
> memory.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/memory.c b/memory.c
> index ac7e73679405..4584673ed0ae 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -6348,13 +6348,13 @@ fill_mem_map_cache(ulong pp, ulong ppend, char *page_cache)
> if (cnt > size)
> cnt = size;
>
> - if (!readmem(addr, KVADDR, bufptr, size,
> + if (!readmem(addr, KVADDR, bufptr, cnt,
> "virtual page struct cache", RETURN_ON_ERROR|QUIET)) {
> - BZERO(bufptr, size);
> - if (!(vt->flags & V_MEM_MAP) && ((addr+size) < ppend))
> + BZERO(bufptr, cnt);
> + if (!(vt->flags & V_MEM_MAP) && ((addr+cnt) < ppend))
> error(WARNING,
> "mem_map[] from %lx to %lx not accessible\n",
> - addr, addr+size);
> + addr, addr+cnt);
> }
>
> addr += cnt;
> --
> 2.18.1
>
More information about the Crash-utility
mailing list