]> git.baikalelectronics.ru Git - kernel.git/commitdiff
efi: libstub: pass image handle to handle_kernel_image()
authorArd Biesheuvel <ardb@kernel.org>
Sat, 19 Mar 2022 17:35:53 +0000 (18:35 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 3 May 2022 13:31:28 +0000 (15:31 +0200)
In a future patch, arm64's implementation of handle_kernel_image() will
omit randomizing the placement of the kernel if the load address was
chosen randomly by the loader. In order to do this, it needs to locate a
protocol on the image handle, so pass it to handle_kernel_image().

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/arm32-stub.c
drivers/firmware/efi/libstub/arm64-stub.c
drivers/firmware/efi/libstub/efi-stub.c
drivers/firmware/efi/libstub/efistub.h
drivers/firmware/efi/libstub/riscv-stub.c

index 4b5b2403b3a07759269e7a1cacf8ceb1ecd49e8b..0131e3aaa6055317993267ca2d354c09cc95f310 100644 (file)
@@ -117,7 +117,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
                                 unsigned long *image_size,
                                 unsigned long *reserve_addr,
                                 unsigned long *reserve_size,
-                                efi_loaded_image_t *image)
+                                efi_loaded_image_t *image,
+                                efi_handle_t image_handle)
 {
        const int slack = TEXT_OFFSET - 5 * PAGE_SIZE;
        int alloc_size = MAX_UNCOMP_KERNEL_SIZE + EFI_PHYS_ALIGN;
index 9cc556013d085991a4825643de486547069e35e2..00c91a3807ea27abd90d1768cd020ec4bfba67a0 100644 (file)
@@ -83,7 +83,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
                                 unsigned long *image_size,
                                 unsigned long *reserve_addr,
                                 unsigned long *reserve_size,
-                                efi_loaded_image_t *image)
+                                efi_loaded_image_t *image,
+                                efi_handle_t image_handle)
 {
        efi_status_t status;
        unsigned long kernel_size, kernel_memsize = 0;
index da93864d7abcd104495e653b7d3079f31c1b7ed0..f515394cce6e23295e93f018a57b4f1aa4c59a37 100644 (file)
@@ -198,7 +198,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
        status = handle_kernel_image(&image_addr, &image_size,
                                     &reserve_addr,
                                     &reserve_size,
-                                    image);
+                                    image, handle);
        if (status != EFI_SUCCESS) {
                efi_err("Failed to relocate kernel\n");
                goto fail_free_screeninfo;
index 2dc24776899a6d062ac84d201d545172792ffcb9..a0477afaa55f9652bf0a56e46803b61dd83e0403 100644 (file)
@@ -939,7 +939,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
                                 unsigned long *image_size,
                                 unsigned long *reserve_addr,
                                 unsigned long *reserve_size,
-                                efi_loaded_image_t *image);
+                                efi_loaded_image_t *image,
+                                efi_handle_t image_handle);
 
 asmlinkage void __noreturn efi_enter_kernel(unsigned long entrypoint,
                                            unsigned long fdt_addr,
index 9c460843442f5ad56a8865a19088d7a2cb3dbcbd..eec043873354af2ad28ccafe04c2f530caf6d0c6 100644 (file)
@@ -80,7 +80,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
                                 unsigned long *image_size,
                                 unsigned long *reserve_addr,
                                 unsigned long *reserve_size,
-                                efi_loaded_image_t *image)
+                                efi_loaded_image_t *image,
+                                efi_handle_t image_handle)
 {
        unsigned long kernel_size = 0;
        unsigned long preferred_addr;