Re: [PATCH] crypto: x86/aria - Take the address of each asm function in one file
From: Herbert Xu
Date: Fri Nov 06 2026 - 06:30:48 EST
On Sun, Oct 11, 2026 at 08:19:21PM -0700, Kees Cook wrote:
> A Clang Full LTO bug[1] was fixed in Clang 23 where multiple .o files
> performing an address-take of the same asm-originating typeid weak symbols
> would have those symbols get completely removed instead of just keeping
> one, seen at link time:
>
> ld.lld: error: undefined symbol: __kcfi_typeid_aria_aesni_avx_encrypt_16way
> >>> referenced by aria-aesni-avx-asm_64.S:962
> >>> vmlinux.o:(__cfi_aria_aesni_avx_encrypt_16way)
>
> As a work-around for earlier Clang, add aria_avx_setup_16way_ops() and
> aria_avx2_setup_32way_ops(), exported by the glue that owns each tier's
> asm functions, and fill all three tables with them, so that each asm
> function has its address taken in only one file.
>
> Build tested ARCH=x86_64 with the kernel test robot's randconfig
> (CONFIG_LTO_CLANG_FULL=y, CONFIG_CFI=y, and all three ARIA drivers built
> in) and W=1, with Clang 22.1.8 and Clang 24.0.0git: vmlinux.o defines all
> fifteen __kcfi_typeid_aria_* symbols, and vmlinux links. Without this
> change, Clang 22.1.8 fails to link it as above, and Clang 24.0.0git,
> which has the LLVM fix, links it.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202606041643.GyTZgCk1-lkp@xxxxxxxxx/
> Closes: https://lore.kernel.org/oe-kbuild-all/202606122021.pA9TozrA-lkp@xxxxxxxxx/
> Closes: https://lore.kernel.org/oe-kbuild-all/202608100432.yIX7TckM-lkp@xxxxxxxxx/
> Closes: https://lore.kernel.org/oe-kbuild-all/202610112311.o9XQsWsa-lkp@xxxxxxxxx/
> Link: https://github.com/llvm/llvm-project/pull/204025 [1]
> Assisted-by: LLM
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
> ---
> arch/x86/crypto/aria-avx.h | 3 +++
> arch/x86/crypto/aria_aesni_avx2_glue.c | 35 ++++++++++++++-----------
> arch/x86/crypto/aria_aesni_avx_glue.c | 29 +++++++++++++-------
> arch/x86/crypto/aria_gfni_avx512_glue.c | 8 ++----
> 4 files changed, 45 insertions(+), 30 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt