[U-Boot] [PATCH] env: fix potential stack overflow in environment functions
Wolfgang Denk
wd at denx.de
Sat Mar 23 01:29:56 CET 2013
Dear Rob Herring,
In message <514CE1A0.7080907 at gmail.com> you wrote:
>
> > Could you please explain what exactly you mean with this "have 4KB
> > stacks" statement?
>
> Well, that's what ARM and PPC have for their stack size. This is not the
> first stack overflow I've fixed. The last was caused by having a large
> printf buffer size:
Please be more precise with what you are talking about...
Normally, the stack is just limited by the amount of available RAM,
i. e. we usually habe tens of megabytes (or more) of stack space.
> commit fcfa696b3a354ab1e16601683c61f671487aded7
> Author: Rob Herring <rob.herring at calxeda.com>
> Date: Thu Jun 28 03:54:11 2012 +0000
>
> ARM: increase lmb stack space reservation to 4KB
What has LMB to do with this, then?
> > Also, why do you think there is more space for data then for stack?
>
> Because in "normal" systems that is the case. It is reasonable to expect
Please define (exactly!) what you consider "normal".
> that a 1MB allocation would be possible for static data or malloc, but
> not for a stack. I could have just increased the stack size, but that is
> a fragile solution.
Usually, on "normal" systems, we have tens or evern hundreds of
megabytes of stack space available.
> > Has this patch been tested on any actual hardware?
>
> Yes. This fixes a problem on actual h/w (highbank). The problem was
> introduced with only an env change.
>
> > I would expect problems, as this code is running before relocation,
> > i. e. when the data segment is not writable?
>
> env_relocate is called by board_init_r at least on ARM which is after
> relocation, right?
This makes no sense to me. After relocation you have basically
unlimited stack space.
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
Nothing ever becomes real until it is experienced. - John Keats
More information about the U-Boot
mailing list