linux/drivers/firmware/efi/libstub
Ard Biesheuvel b3879a4d3a efi/libstub: Make file I/O chunking x86-specific
The ARM decompressor is finicky when it comes to uninitialized variables
with local linkage, the reason being that it may relocate .text and .bss
independently when executing from ROM. This is only possible if all
references into .bss from .text are absolute, and this happens to be the
case for references emitted under -fpic to symbols with external linkage,
and so all .bss references must involve symbols with external linkage.

When building the ARM stub using clang, the initialized local variable
__chunk_size is optimized into a zero-initialized flag that indicates
whether chunking is in effect or not. This flag is therefore emitted into
.bss, which triggers the ARM decompressor's diagnostics, resulting in a
failed build.

Under UEFI, we never execute the decompressor from ROM, so the diagnostic
makes little sense here. But we can easily work around the issue by making
__chunk_size global instead.

However, given that the file I/O chunking that is controlled by the
__chunk_size variable is intended to work around known bugs on various
x86 implementations of UEFI, we can simply make the chunking an x86
specific feature. This is an improvement by itself, and also removes the
need to parse the efi= options in the stub entirely.

Tested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1486380166-31868-8-git-send-email-ard.biesheuvel@linaro.org
[ Small readability edits. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-02-07 10:42:11 +01:00
..
Makefile efi: Get and store the secure boot status 2017-02-07 10:42:10 +01:00
arm-stub.c efi: Get and store the secure boot status 2017-02-07 10:42:10 +01:00
arm32-stub.c efi/arm/libstub: Make screen_info accessible to the UEFI stub 2016-04-28 11:33:59 +02:00
arm64-stub.c arm64: kaslr: increase randomization granularity 2016-04-28 19:44:15 +01:00
efi-stub-helper.c efi/libstub: Make file I/O chunking x86-specific 2017-02-07 10:42:11 +01:00
efistub.h efi: Deduplicate efi_file_size() / _read() / _close() 2017-02-01 08:45:42 +01:00
fdt.c efi/fdt: Avoid FDT manipulation after ExitBootServices() 2017-02-01 21:17:49 +01:00
gop.c efi/libstub: Move Graphics Output Protocol handling to generic code 2016-04-28 11:33:57 +02:00
random.c efi/libstub: Make efi_random_alloc() allocate below 4 GB on 32-bit 2016-11-25 07:15:23 +01:00
secureboot.c efi: Disable secure boot if shim is in insecure mode 2017-02-07 10:42:10 +01:00
string.c arm64/efi: isolate EFI stub from the kernel proper 2015-10-12 16:20:12 +01:00