[PATCH v2 0/3] arm64: head: pad Image header to 64 KB and unmap it

Ard Biesheuvel ardb at kernel.org
Tue Nov 17 07:47:26 EST 2020


The EFI header definition was updated recently to increase the section
alignment to 64 KB, which causes the EFI loader to put the kernel Image
at an offset that is guaranteed to be compatible with the kernel's image
placement policy when CONFIG_RELOCATABLE=y, removing the need to move it
around in DRAM before boot.

This change failed to take into account that the first section in the
PE/COFF description should start at a 64 KB aligned boundary as well,
and so even though EFI loaders don't seem to care, the current PE/COFF
layout is not 100% compliant.

So let's fix this by padding the size of the .head region to 64 KB,
and while at it, removing it from the kernel's executable mapping, which
is now guaranteed to be possible regardless of the page size the kernel
is running with. And if we don't map it, we don't need to reserve it
either.

Changes since v1:
- drop the original first patch that fixed the actual bug - it has already
  been merged
- add Will's acks
- use a better NOP and a better name for the macro that emits it (#3)

Cc: catalin.marinas at arm.com
Cc: will at kernel.org
Cc: mark.rutland at arm.com
Cc: james.morse at arm.com
Cc: robin.murphy at arm.com

Ard Biesheuvel (3):
  arm64: omit [_text, _stext) from permanent kernel mapping
  arm64/head: avoid symbol names pointing into first 64 KB of kernel
    image
  arm64: head: tidy up the Image header definition

 arch/arm64/kernel/efi-header.S  | 84 ++++++++++++--------
 arch/arm64/kernel/head.S        | 19 +----
 arch/arm64/kernel/setup.c       |  4 +-
 arch/arm64/kernel/vmlinux.lds.S |  2 +-
 arch/arm64/mm/init.c            |  2 +-
 arch/arm64/mm/mmu.c             | 10 +--
 6 files changed, 60 insertions(+), 61 deletions(-)

-- 
2.20.1




More information about the linux-arm-kernel mailing list