[PATCH] vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment

Kees Cook keescook at chromium.org
Thu Sep 22 15:18:01 PDT 2022


On Thu, Sep 22, 2022 at 10:57:15PM +0100, Will Deacon wrote:
> Due to undocumented, hysterical raisins on x86, the CFI jump-table
> sections in .text are needlessly aligned to PMD_SIZE in the vmlinux
> linker script. When compiling a CFI-enabled arm64 kernel with a 64KiB
> page-size, a PMD maps 512MiB of virtual memory and so the .text section
> increases to a whopping 940MiB and blows the final Image up to 960MiB.
> Others report a link failure.

Heh. "That's not an image ... THIS is an image."[1]

> Since the CFI jump-table requires only instruction alignment, reduce the
> alignment directives to function alignment for parity with other parts
> of the .text section. This reduces the size of the .text section for the
> aforementioned 64KiB page size arm64 kernel to 19MiB for a much more
> reasonable total Image size of 39MiB.

❤️

Reviewed-by: Kees Cook <keescook at chromium.org>

-Kees

[1] https://www.youtube.com/watch?v=rne8pOxGuwM#t=27

-- 
Kees Cook



More information about the linux-arm-kernel mailing list