
Dear Heinrich,
In message 450f8b6e-b2c0-0a5f-14e0-50c58103aec5@gmx.de you wrote:
I think this is not that complicated. At least in standard U-Boot (not speaking for SPL) it should be sufficient to check the current stack pointer (which is easy to read) and take this a upper limit of available/allowed memory. If we add some reasonable safety margin (say, 1 MB or so) we should be really safe.
Unfortunately this does not hold true. E.g. the Odroid-C2 has the secure monitor in the middle of the RAM. You would not want to overwrite those addresses.
Urgh... Is there a (technical, say hardware) reason for such a unlucky design? Who would willingly fragment memory like that?
For a board with a device tree all reserved memory areas should be secured against overwriting.
True.
Best regards,
Wolfgang Denk