This is a note to let you know that I've just added the patch titled vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment to the 5.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: vmlinux.lds.h-cfi-reduce-alignment-of-jump-table-to-function-alignment.patch and it can be found in the queue-5.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 13b0566962914e167cb3238fbe29ced618f07a27 Mon Sep 17 00:00:00 2001 From: Will Deacon <will@xxxxxxxxxx> Date: Thu, 22 Sep 2022 22:57:15 +0100 Subject: vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment From: Will Deacon <will@xxxxxxxxxx> 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@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: "Mohan Rao .vanimina" <mailtoc.mohanrao@xxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Nathan Chancellor <nathan@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@xxxxxxxxxxxxxx/ Fixes: cf68fffb66d6 ("add support for Clang CFI") Reviewed-by: Mark Rutland <mark.rutland@xxxxxxx> Tested-by: Mark Rutland <mark.rutland@xxxxxxx> Reviewed-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/20220922215715.13345-1-will@xxxxxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/asm-generic/vmlinux.lds.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -543,10 +543,9 @@ */ #ifdef CONFIG_CFI_CLANG #define TEXT_CFI_JT \ - . = ALIGN(PMD_SIZE); \ + ALIGN_FUNCTION(); \ __cfi_jt_start = .; \ *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) \ - . = ALIGN(PMD_SIZE); \ __cfi_jt_end = .; #else #define TEXT_CFI_JT Patches currently in stable-queue which might be from will@xxxxxxxxxx are queue-5.19/perf-arm-cmn-add-more-bits-to-child-node-address-offset-field.patch queue-5.19/arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch queue-5.19/vmlinux.lds.h-cfi-reduce-alignment-of-jump-table-to-function-alignment.patch