u-boot/lib/efi_loader
Robin Randhawa 991d62fa73 efi_loader: Fix crash on 32-bit systems
A type mismatch in the efi_allocate_pool boot service flow causes
hazardous memory scribbling on 32-bit systems.

This is efi_allocate_pool's prototype:

static efi_status_t EFIAPI efi_allocate_pool(int pool_type,
						    unsigned long size,
						    void **buffer);

Internally, it invokes efi_allocate_pages as follows:

efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12,
					    (void*)buffer);

This is efi_allocate_pages' prototype:

efi_status_t efi_allocate_pages(int type, int memory_type,
					unsigned long pages,
					uint64_t *memory);

The problem: efi_allocate_pages does this internally:

    *memory = addr;

This fix in efi_allocate_pool uses a transitional uintptr_t cast to
ensure the correct outcome, irrespective of the system's native word
size.

This was observed when bootefi'ing the EFI instance of FreeBSD's first
stage bootstrap (boot1.efi) on a 32-bit ARM platform (Qemu VExpress +
Cortex-a9).

Signed-off-by: Robin Randhawa <robin.randhawa@arm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2016-10-18 09:08:07 +02:00
..
Kconfig efi_loader: Add bounce buffer support 2016-05-27 15:39:48 -04:00
Makefile efi_loader: Add network access support 2016-05-27 10:01:10 -04:00
efi_boottime.c efi_loader: Fix crash on 32-bit systems 2016-10-18 09:08:07 +02:00
efi_console.c efi_loader: Add console interface 2016-03-15 18:03:09 -04:00
efi_disk.c efi_loader: disk: Sanitize exposed devices 2016-08-08 13:33:00 -04:00
efi_gop.c efi_loader: Add DM_VIDEO support 2016-06-06 13:39:17 -04:00
efi_image_loader.c efi_loader: Fix relocations above 64kb image size 2016-08-20 14:03:27 -04:00
efi_memory.c efi_loader: Fix memory map size check to avoid out-of-bounds access 2016-10-18 09:08:07 +02:00
efi_net.c efi_loader: Add network access support 2016-05-27 10:01:10 -04:00
efi_runtime.c efi_loader: Move to normal debug infrastructure 2016-06-06 13:39:16 -04:00