Commit f54a36f0 authored by Will Deacon's avatar Will Deacon Committed by Juan Yescas
Browse files

UPSTREAM: vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment

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.

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.

Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: "Mohan Rao .vanimina" <mailtoc.mohanrao@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@mail.gmail.com/


Fixes: cf68fffb ("add support for Clang CFI")
Change-Id: I56391d29d76087e9ad7a8e11ac688d0a1ae9b376
Signed-off-by: default avatarWill Deacon <will@kernel.org>
(cherry picked from commit 13b05669)
Signed-off-by: default avatarJuan Yescas <jyescas@google.com>
parent 2d58698e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment