Skip to content

Commit ff80ef5

Browse files
committed
efi/libstub: arm64: Warn when efi_random_alloc() fails
Randomization of the physical load address of the kernel image relies on efi_random_alloc() returning successfully, and currently, we ignore any failures and just carry on, using the ordinary, non-randomized page allocator routine. This means we never find out if a failure occurs, which could harm security, so let's at least warn about this condition. Signed-off-by: Ard Biesheuvel <[email protected]> Tested-by: Benjamin Herrenschmidt <[email protected]>
1 parent 3a26242 commit ff80ef5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/firmware/efi/libstub/arm64-stub.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
130130
*/
131131
status = efi_random_alloc(*reserve_size, min_kimg_align,
132132
reserve_addr, phys_seed);
133+
if (status != EFI_SUCCESS)
134+
efi_warn("efi_random_alloc() failed: 0x%lx\n", status);
133135
} else {
134136
status = EFI_OUT_OF_RESOURCES;
135137
}

0 commit comments

Comments
 (0)