Skip to content

Commit

Permalink
x86/boot: efistub: Assign global boot_params variable
Browse files Browse the repository at this point in the history
Now that the x86 EFI stub calls into some APIs exposed by the
decompressor (e.g., kaslr_get_random_long()), it is necessary to ensure
that the global boot_params variable is set correctly before doing so.

Note that the decompressor and the kernel proper carry conflicting
declarations for the global variable 'boot_params' so refer to it via an
alias to work around this.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Ard Biesheuvel committed Oct 17, 2023
1 parent 0d3ad19 commit db77241
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/firmware/efi/libstub/x86-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
unsigned long kernel_entry;
efi_status_t status;

boot_params_pointer = boot_params;

efi_system_table = sys_table_arg;
/* Check if we were booted by the EFI firmware */
if (efi_system_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
Expand Down
2 changes: 2 additions & 0 deletions drivers/firmware/efi/libstub/x86-stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <linux/efi.h>

extern struct boot_params *boot_params_pointer asm("boot_params");

extern void trampoline_32bit_src(void *, bool);
extern const u16 trampoline_ljmp_imm_offset;

Expand Down

0 comments on commit db77241

Please sign in to comment.