On Sun, Feb 8, 2026 at 4:19 PM Marek Vasut <[email protected]> wrote:
>
> On 2/8/26 11:37 PM, James Hilliard wrote:
> > boot_get_fdt_fit() relocates the base FDT with boot_relocate_fdt()
> > before applying overlays. That uses the bootm memory map and can
> > overlap with the FIT buffer when the FIT is loaded into RAM, corrupting
> > data needed to load the kernel and ramdisk.
> >
> > Allocate a writable copy of the base FDT with memalign() and
> > fdt_open_into(), grow it as needed for each overlay, and apply the
> > overlays to this buffer. Also check fdt_pack() errors and free the
> > temporary overlay copy after each application.
> >
> > Fixes: 881f0b77dc8c ("image: apply FDTOs on FDT node")
> > Signed-off-by: James Hilliard <[email protected]>
> This code is starting to be super-convoluted. Can you please have a look
> at [1] and see if that can be somehow extended to cover this ? I think
> it should trim the complexity, but it likely needs a bit more work.

Hmm, that kinda looks like it's solving a different issue? At least I'm
not really seeing an obvious way an alignment refactor like that
would help with this issue with a bad relocation corrupting the FIT
buffer.

I agree the code here is a bit convoluted, so maybe I'm missing the
relation between the fdt alignment and the relocation location issues.

>
> Thank you
>
> [1]
> https://lore.kernel.org/u-boot/[email protected]/
>

Reply via email to