[PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code

Tony Lindgren tony at atomide.com
Fri Apr 29 03:03:34 EDT 2011


* Nicolas Pitre <nico at fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre at linaro.org>
> 
> If the zImage load address is slightly below the relocation address,
> there is a risk for the copied data to overwrite the copy loop or
> cache flush code that the relocation process requires.  Always
> bump the relocation address by the size of that code to avoid this
> issue.
> 
> Noticed by Tony Lindgren <tony at atomide.com>.
> 
> While at it, let's start the copy from the restart symbol which makes
> the above code size computation possible by the assembler directly,
> given that we don't need to preserve the code before that point anyway.
> And therefore we don't need to carry the _start pointer in r5 anymore.
> 
> Signed-off-by: Nicolas Pitre <nicolas.pitre at linaro.org>

Cool, this works for my test case:

Tested-by: Tony Lindgren <tony at atomide.com>



More information about the linux-arm-kernel mailing list