]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment
authorWill Deacon <will@kernel.org>
Thu, 22 Sep 2022 21:57:15 +0000 (22:57 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:11:40 +0000 (15:11 +0100)
commita862fd3ad261ef0d997d93e7195487f684e80e5c
treecac4be35caa89e5b38da58be695df98705ea1215
parent807b954a8544467aa6b628afa8095646d94ddf4a
vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment

BugLink: https://bugs.launchpad.net/bugs/1995420
commit 13b0566962914e167cb3238fbe29ced618f07a27 upstream.

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>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@mail.gmail.com/
Fixes: cf68fffb66d6 ("add support for Clang CFI")
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220922215715.13345-1-will@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/asm-generic/vmlinux.lds.h