diff options
author | 2022-11-22 17:10:07 +0100 | |
---|---|---|
committer | 2022-11-24 08:55:55 +0100 | |
commit | 4b52016247aeaa55ca3e3bc2e03cd91114c145c2 (patch) | |
tree | dbd637079dd18c6d25b952137b33ee1d7ceace02 /drivers/firmware | |
parent | x86/boot/compressed: Move efi32_pe_entry() out of head_64.S (diff) | |
download | linux-4b52016247aeaa55ca3e3bc2e03cd91114c145c2.tar.gz linux-4b52016247aeaa55ca3e3bc2e03cd91114c145c2.tar.bz2 linux-4b52016247aeaa55ca3e3bc2e03cd91114c145c2.zip |
x86/boot/compressed, efi: Merge multiple definitions of image_offset into one
There is no need for head_32.S and head_64.S both declaring a copy of
the global 'image_offset' variable, so drop those and make the extern C
declaration the definition.
When image_offset is moved to the .c file, it needs to be placed
particularly in the .data section because it lands by default in the
.bss section which is cleared too late, in .Lrelocated, before the first
access to it and thus garbage gets read, leading to SEV guests exploding
in early boot.
This happens only when the SEV guest kernel is loaded through grub. If
supplied with qemu's -kernel command line option, that memory is always
cleared upfront by qemu and all is fine there.
[ bp: Expand commit message with SEV aspect. ]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221122161017.2426828-8-ardb@kernel.org
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/libstub/x86-stub.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 33a7811e12c6..a0bfd31358ba 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -23,7 +23,7 @@ const efi_system_table_t *efi_system_table; const efi_dxe_services_table_t *efi_dxe_table; -extern u32 image_offset; +u32 image_offset __section(".data"); static efi_loaded_image_t *image = NULL; static efi_status_t |