All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip: efi/urgent] efi/libstub: arm64: Warn when efi_random_alloc() fails
@ 2021-08-10  8:30 tip-bot2 for Ard Biesheuvel
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Ard Biesheuvel @ 2021-08-10  8:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Ard Biesheuvel, Benjamin Herrenschmidt, x86, linux-kernel

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     ff80ef5bf5bd59e5eab82d1d846acc613ebbf6c4
Gitweb:        https://git.kernel.org/tip/ff80ef5bf5bd59e5eab82d1d846acc613ebbf6c4
Author:        Ard Biesheuvel <ardb@kernel.org>
AuthorDate:    Mon, 26 Jul 2021 16:24:01 +02:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Tue, 03 Aug 2021 07:43:07 +02:00

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>
---
 drivers/firmware/efi/libstub/arm64-stub.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
index 6f214c9..010564f 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;
 	}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-10  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  8:30 [tip: efi/urgent] efi/libstub: arm64: Warn when efi_random_alloc() fails tip-bot2 for Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.