• Ard Biesheuvel's avatar
    efi/libstub: Make file I/O chunking x86-specific · 6d075d21
    Ard Biesheuvel authored
    (commit b3879a4d upstream)
    
    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: 's avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: 's avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: 's avatarMatt 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: 's avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: 's avatarNick Desaulniers <ndesaulniers@google.com>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    6d075d21
Name
Last commit
Last update
..
broadcom Loading commit data...
efi Loading commit data...
google Loading commit data...
meson Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
arm_scpi.c Loading commit data...
dcdbas.c Loading commit data...
dcdbas.h Loading commit data...
dell_rbu.c Loading commit data...
dmi-id.c Loading commit data...
dmi-sysfs.c Loading commit data...
dmi_scan.c Loading commit data...
edd.c Loading commit data...
iscsi_ibft.c Loading commit data...
iscsi_ibft_find.c Loading commit data...
memmap.c Loading commit data...
pcdp.c Loading commit data...
pcdp.h Loading commit data...
psci.c Loading commit data...
qcom_scm-32.c Loading commit data...
qcom_scm-64.c Loading commit data...
qcom_scm.c Loading commit data...
qcom_scm.h Loading commit data...
qemu_fw_cfg.c Loading commit data...
raspberrypi.c Loading commit data...
scpi_pm_domain.c Loading commit data...