[PATCH] kvx: exclude dtb from malloc zone

Sascha Hauer s.hauer at pengutronix.de
Sat Jul 11 00:41:35 EDT 2020


Hi Clement,

On Thu, Jul 09, 2020 at 10:22:04PM +0200, Clement Leger wrote:
> When dtb is provided by the FSBL (first stage bootloader), it might
> end up in the malloc zone initialized by barebox. While the dtb is
> discarded after being unflatten, if the dtb is provided right after
> barebox elf, then the malloc can overwrite it while unflattening it when
> allocating nodes.
> To avoid that, exclude the dtb from the malloc zone by checking if it
> overlaps it. If so, determine the largest zone for the allocation and
> modify the memory area to use that.

Isn't there some safe place where the dtb can be copied to? Making the
malloc area smaller seems a bit wasteful.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list