aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-02-06 06:22:46 -0500
committerIngo Molnar <mingo@kernel.org>2017-02-07 04:42:11 -0500
commitb3879a4d3a31ef14265a52e8d941cf4b0f6627ae (patch)
tree9005b18d481c303abb01be8a472e0971f3553455
parent9661b332041dab63ba2e5222b40a9f916c1368a9 (diff)
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>
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 6ee9164251a9..919822b7773d 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -414,6 +414,14 @@ efi_status_t efi_parse_options(char *cmdline)
414 char *str; 414 char *str;
415 415
416 /* 416 /*
417 * Currently, the only efi= option we look for is 'nochunk', which
418 * is intended to work around known issues on certain x86 UEFI
419 * versions. So ignore for now on other architectures.
420 */
421 if (!IS_ENABLED(CONFIG_X86))
422 return EFI_SUCCESS;
423
424 /*
417 * If no EFI parameters were specified on the cmdline we've got 425 * If no EFI parameters were specified on the cmdline we've got
418 * nothing to do. 426 * nothing to do.
419 */ 427 */
@@ -586,7 +594,8 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
586 size = files[j].size; 594 size = files[j].size;
587 while (size) { 595 while (size) {
588 unsigned long chunksize; 596 unsigned long chunksize;
589 if (size > __chunk_size) 597
598 if (IS_ENABLED(CONFIG_X86) && size > __chunk_size)
590 chunksize = __chunk_size; 599 chunksize = __chunk_size;
591 else 600 else
592 chunksize = size; 601 chunksize = size;