[PATCH 2/6] efi: Convert device_path allocation to use malloc()

Simon Glass sjg at chromium.org
Fri Jul 26 01:32:01 CEST 2024


Hi Heinrich,

On Thu, 25 Jul 2024 at 10:18, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 25.07.24 15:56, Simon Glass wrote:
> > Currently this calls efi_alloc() which reserves a page for each
> > allocation and this can overwrite memory that will be used for reading
> > images.
>
> We already agreed to integrate LMB and UEFI memory management to avoid
> this sort of problem.

Yes that series will be good in general, but I don't believe that will
fix either problem:

- Using LMB for tiny allocations doesn't really make any more sense
than allocating a 4KB page for each one.
- LMB cannot stop overwriting memory used by kern_addr_r, for example,
as mentioned in the other patch

>
> Please, have a look at chapter 10.5, "Device Path Utilities Protocol" of
> the UEFI specification.
>
> EFI_DEVICE_PATH_UTILITIES_PROTOCOL.DuplicateDevicePath() must return
> memory that an EFI application can release by calling
> EFI_BOOT_SERVICES.FreePool().
>
> Your patch does not comply to the specification.

Oh yes, I mistakenly changed the ordering of the patches before
sending...this one should go after the pool one.

Regards,
Simon


More information about the U-Boot mailing list