linux-stable/drivers/firmware/efi
Will Deacon 7c116db24d efi/libstub/arm64: Retain 2MB kernel Image alignment if !KASLR
Since commit 82046702e2 ("efi/libstub/arm64: Replace 'preferred' offset
with alignment check"), loading a relocatable arm64 kernel at a physical
address which is not 2MB aligned and subsequently booting with EFI will
leave the Image in-place, relying on the kernel to relocate itself early
during boot. In conjunction with commit dd4bc60765 ("arm64: warn on
incorrect placement of the kernel by the bootloader"), which enables
CONFIG_RELOCATABLE by default, this effectively means that entering an
arm64 kernel loaded at an alignment smaller than 2MB with EFI (e.g. using
QEMU) will result in silent relocation at runtime.

Unfortunately, this has a subtle but confusing affect for developers
trying to inspect the PC value during a crash and comparing it to the
symbol addresses in vmlinux using tools such as 'nm' or 'addr2line';
all text addresses will be displaced by a sub-2MB offset, resulting in
the wrong symbol being identified in many cases. Passing "nokaslr" on
the command line or disabling "CONFIG_RANDOMIZE_BASE" does not help,
since the EFI stub only copies the kernel Image to a 2MB boundary if it
is not relocatable.

Adjust the EFI stub for arm64 so that the minimum Image alignment is 2MB
unless KASLR is in use.

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: David Brazdil <dbrazdil@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
2020-07-13 14:08:07 +01:00
..
libstub efi/libstub/arm64: Retain 2MB kernel Image alignment if !KASLR 2020-07-13 14:08:07 +01:00
test efi_test: get rid of pointless access_ok() 2020-05-29 11:05:54 -04:00
apple-properties.c efi/dev-path-parser: Add struct definition for vendor type device path nodes 2020-02-23 21:59:42 +01:00
arm-init.c efi: Clean up config table description arrays 2020-04-24 14:52:16 +02:00
arm-runtime.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
capsule-loader.c efi/capsule-loader: Drop superfluous assignment 2020-02-23 21:58:31 +01:00
capsule.c
cper-arm.c
cper-x86.c
cper.c efi: cper: Add support for printing Firmware Error Record Reference 2020-05-14 11:11:20 +02:00
dev-path-parser.c efi/dev-path-parser: Add struct definition for vendor type device path nodes 2020-02-23 21:59:42 +01:00
earlycon.c efi/earlycon: Fix early printk for wider fonts 2020-05-12 12:29:45 +02:00
efi-bgrt.c efi/bgrt: Accept BGRT tables with a version of 0 2020-02-22 23:37:37 +01:00
efi-pstore.c efi: Fix a mistype in comments mentioning efivar_entry_iter_begin() 2020-03-08 10:00:07 +01:00
efi.c mmap locking API: add MMAP_LOCK_INITIALIZER 2020-06-09 09:39:14 -07:00
efibc.c
efivars.c efi/efivars: Add missing kobject_put() in sysfs entry creation error path 2020-05-22 18:19:06 +02:00
embedded-firmware.c platform/x86: touchscreen_dmi: Add EFI embedded firmware info support 2020-03-20 14:57:54 +01:00
esrt.c efi/esrt: Clean up efi_esrt_init 2020-02-23 21:57:59 +01:00
fake_mem.c efi: Fix handling of multiple efi_fake_mem= entries 2020-01-20 08:14:29 +01:00
fake_mem.h x86/efi: Add efi_fake_mem support for EFI_MEMORY_SP 2019-11-07 15:44:23 +01:00
fdtparams.c efi/arm: Rewrite FDT param discovery routines 2020-02-23 21:59:42 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile efi/libstub: Avoid linking libstub/lib-ksyms.o into vmlinux 2020-03-08 10:00:06 +01:00
memattr.c efi: Move mem_attr_table out of struct efi 2020-02-23 21:59:42 +01:00
memmap.c efi: Fix handling of multiple efi_fake_mem= entries 2020-01-20 08:14:29 +01:00
rci2-table.c efi: Don't attempt to map RCI2 config table if it doesn't exist 2019-12-10 12:13:02 +01:00
reboot.c efi: Use EFI ResetSystem only when available 2020-02-23 21:59:42 +01:00
runtime-map.c
runtime-wrappers.c efi: Add 'runtime' pointer to struct efi 2020-02-23 21:59:42 +01:00
tpm.c EFI fixes for v5.7-rc6: 2020-05-22 20:06:25 +02:00
vars.c efi: Fix a mistype in comments mentioning efivar_entry_iter_begin() 2020-03-08 10:00:07 +01:00
x86_fake_mem.c x86/efi: Add efi_fake_mem support for EFI_MEMORY_SP 2019-11-07 15:44:23 +01:00