PATCH: bug in locate_hole()

Matthew Fleming mdf356 at gmail.com
Tue Mar 4 21:52:17 EST 2014


On Mon, Mar 3, 2014 at 4:34 PM, Matthew Fleming <mdf356 at gmail.com> wrote:
> In upgrading to kexec-tools 2.0.5 I first got the error "Overlapping
> memory segments at 0xbeff000"
>
> Adding some debugging I found locate_hole was returning incorrect
> values.  The below is from the debug I added:
>
> XXXMDF: look for hole size 100000, cur range [52b3000, bffffff] size 6d4cfff
> XXXMDF: look for hole memsz=100000, found beff000
>
> Hmm, if we wanted 0x100000 bytes ending at 0xbffffff, that should be
> 0xbf00000, not 0xbef000.  Continuing to the second invocation:
>
> XXXMDF: look for hole size 1000, cur range [52b3000, befefff] size 6c4bfff
> XXXMDF: look for hole size 1000, cur range [bfff000, bffffff] size fff
> XXXMDF: look for hole memsz=1000, found bffe000
>
> Now we die with overlapping ranges, since the 0x100000 bytes at
> 0xbeff000 overlaps 0x1000 bytes at 0xbffe000.
>
> The attached patch fixes the off-by-one that causes the later overlap.

Fix an off-by-one in locate_hole() that can cause it to return a range
that was previously allocated.

Signed-off-by: Matthew Fleming <mdf356 at gmail.com>

Cheers,
matthew



More information about the kexec mailing list