lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Sep 2022 15:00:21 -0700
From:   Sami Tolvanen <samitolvanen@...gle.com>
To:     Will Deacon <will@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        Mark Rutland <mark.rutland@....com>,
        "Mohan Rao .vanimina" <mailtoc.mohanrao@...il.com>,
        Kees Cook <keescook@...omium.org>,
        Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH] vmlinux.lds.h: CFI: Reduce alignment of jump-table to
 function alignment

On Thu, Sep 22, 2022 at 2:57 PM Will Deacon <will@...nel.org> 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.
>
> 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@...gle.com>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: "Mohan Rao .vanimina" <mailtoc.mohanrao@...il.com>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Nathan Chancellor <nathan@...nel.org>
> Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@mail.gmail.com/
> Fixes: cf68fffb66d60 ("add support for Clang CFI")
> Signed-off-by: Will Deacon <will@...nel.org>
> ---
>  include/asm-generic/vmlinux.lds.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 7515a465ec03..7c90b1ab3e00 100644
> --- 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

Thanks for sending the patch!

Reviewed-by: Sami Tolvanen <samitolvanen@...gle.com>

Sami

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ