[PATCH v2 0/3] efi_loader: consider EFI memory map

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Thu Jan 5 21:25:33 CET 2023


As reported in Debian bug #1027176 relocation of the initrd may lead to
overwriting memory used by the EFI sub-system.

Currently the available memory for images is determined via the lmb
library functions. The lmb library has several shortcomings:

* It does not protect against overwriting one image with another.
* The same routines to find reserved memory are called again and
  again.

In the long run we should move to allocating memory for images.

As an intermediate solutions let's add lmb-reservations for all EFI memory
areas that are not EFI_CONVENTIONAL_MEMORY.

The variable $loadaddr of at least the vexpress_ca9x4 board collids with
memory used by the EFI sub-system. Adjust $loadaddr for the vexpress
boards to a sane value.

v2:
	carve out efi_get_memory_map_alloc()

Heinrich Schuchardt (3):
  vexpress: adjust loadaddr
  efi_loader: carve out efi_get_memory_map_alloc()
  lmb: consider EFI memory map

 cmd/efidebug.c                    | 18 ++++------------
 include/configs/vexpress_common.h |  1 +
 include/efi_loader.h              |  3 +++
 lib/efi_loader/efi_memory.c       | 34 +++++++++++++++++++++++++++++
 lib/lmb.c                         | 36 +++++++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 14 deletions(-)

-- 
2.37.2



More information about the U-Boot mailing list