[U-Boot] env: fix potential stack overflow in environment functions
Wolfgang Denk
wd at denx.de
Fri Apr 5 18:15:57 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
This looks to be conceptually broken to me. You cannot just
lmb_reserve() arbitrary amounts of memory, when the documented,
pubished memory map clearly states that this memory is "free", and in
use for the downward growing stack. If you need memory, you must
reserve it in a clearly documented way.
A part of the problem appears to be that it's actually very difficult
to even understand how the mnemory concept of LMB has been designed -
it it was designed at all. Is there any related documentation?
> debugging my environment getting corrupted and saw large buffers on the
> stack. My problem was ultimately that blank lines in mvenvimage input
> files are not handled correctly giving intermittent issues with the env
> import. I'm still not clear why the issue was intermittent, but I think
> mkenvimage should skip/remove blank lines. I still need to make a fix
> for that.
No, it should not. It is supposed to keep the very formatting chosen
by the implementor.
The core of the problem is the illegal, and totally undocumented
assumptions LMB appears to be making.
_This_ is what needs to be fixed.
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
ATTENTION: Despite Any Other Listing of Product Contents Found Here-
on, the Consumer is Advised That, in Actuality, This Product Consists
Of 99.9999999999% Empty Space.
More information about the U-Boot
mailing list