[U-Boot] env: fix potential stack overflow in environment functions

Wolfgang Denk wd at denx.de
Fri Apr 5 18:21:03 CEST 2013


Dear Rob Herring,

In message <515EED36.9090305 at gmail.com> you wrote:
>
> The stack size limit only comes into play when bootm runs and starts
> moving initrd and dtb to high addresses below the stack. At that point,
> the stack size does become limited because only 4KB (recently increase
> from 1KB) of space is reserved. So I had this in mind when I started

BTW - the ARM code is simply broken - see "arch/arm/lib/bootm.c":

 74         lmb_reserve(lmb, sp,
 75                     gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);

What if we have more than one memory bank?  Then the computation above
is pretty much random...


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is more rational to sacrifice one life than six.
	-- Spock, "The Galileo Seven", stardate 2822.3


More information about the U-Boot mailing list