aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2021-07-26 16:24:01 +0200
committerArd Biesheuvel <ardb@kernel.org>2021-08-03 07:43:07 +0200
commitff80ef5bf5bd59e5eab82d1d846acc613ebbf6c4 (patch)
tree5112b8bff7532ef4f26bdcb4404117387d2c8c47 /drivers/firmware
parentefi/libstub: arm64: Relax 2M alignment again for relocatable kernels (diff)
downloadlinux-dev-ff80ef5bf5bd59e5eab82d1d846acc613ebbf6c4.tar.xz
linux-dev-ff80ef5bf5bd59e5eab82d1d846acc613ebbf6c4.zip
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 <ardb@kernel.org> Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/libstub/arm64-stub.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
index 6f214c9c303e..010564f8bbc4 100644
--- a/drivers/firmware/efi/libstub/arm64-stub.c
+++ b/drivers/firmware/efi/libstub/arm64-stub.c
@@ -130,6 +130,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
*/
status = efi_random_alloc(*reserve_size, min_kimg_align,
reserve_addr, phys_seed);
+ if (status != EFI_SUCCESS)
+ efi_warn("efi_random_alloc() failed: 0x%lx\n", status);
} else {
status = EFI_OUT_OF_RESOURCES;
}