RE: [PATCH] makedumpfile: Fix off-by-one issue in exclude_nodata_pages()

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

 



Hi Mikhail,

> -----Original Message-----
> When building a dump bitmap (2nd bitmap) for the ELF dump, the last pfn
> of the cycle is always ignored in exclude_nodata_pages() function due to
> off-by-one error on cycle boundary check. Thus, the respective bit of
> the bitmap is never cleared.
> That can lead to the error when such a pfn should not be dumpable (e.g.
> the last pfn of the ELF-load of zero filesize). Based on the bit in the
> bitmap the page is treated as dumpable in write_elf_pages_cyclic() function
> and the follow on error is triggered in write_elf_load_segment() function
> due to the failing sanity check of paddr_to_offset2():

Good catch.  I could reproduce this issue with a vmcore on hand and
confirm that the patch fixed it.  Looks good to me, applied.

Thanks,
Kazu

> 
>    $ makedumpfile -E dump.elf dump.elf.E
>    Checking for memory holes                         : [100.0 %] |
>    write_elf_load_segment: Can't convert physaddr(7ffff000) to an offset.
>    makedumpfile Failed.
> 
> Signed-off-by: Mikhail Zaslonko <zaslonko@xxxxxxxxxxxxx>
> ---
>  makedumpfile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/makedumpfile.c b/makedumpfile.c
> index de0973f..4a00011 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -4740,7 +4740,7 @@ exclude_nodata_pages(struct cycle *cycle)
>  		if (pfn < cycle->start_pfn)
>  			pfn = cycle->start_pfn;
>  		if (pfn_end >= cycle->end_pfn)
> -			pfn_end = cycle->end_pfn - 1;
> +			pfn_end = cycle->end_pfn;
>  		while (pfn < pfn_end) {
>  			clear_bit_on_2nd_bitmap(pfn, cycle);
>  			++pfn;
> --
> 2.17.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/kexec



_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux