Re: ld.lld: error: undefined symbol: __tsan_memset

From: Marco Elver
Date: Fri Dec 02 2022 - 04:43:08 EST


On Fri, 2 Dec 2022 at 10:32, kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Kefeng,
>
> FYI, the error/warning still remains.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: a4412fdd49dc011bcc2c0d81ac4cab7457092650
> commit: dd03762ab608e058c8f390ad9cf667e490089796 arm64: Enable KCSAN
> date: 12 months ago
> config: arm64-randconfig-r006-20221201
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install arm64 cross compiling tool for clang build
> # apt-get install binutils-aarch64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd03762ab608e058c8f390ad9cf667e490089796
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout dd03762ab608e058c8f390ad9cf667e490089796
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> >> ld.lld: error: undefined symbol: __tsan_memset
> >>> referenced by main.c
> >>> main.o:(init_setup) in archive init/built-in.a
> >>> referenced by main.c
> >>> main.o:(rdinit_setup) in archive init/built-in.a
> >>> referenced by main.c
> >>> main.o:(do_one_initcall) in archive init/built-in.a
> >>> referenced 8519 more times
> --
> >> ld.lld: error: undefined symbol: __tsan_memcpy
> >>> referenced by main.c
> >>> main.o:(do_one_initcall) in archive init/built-in.a
> >>> referenced by initramfs.c
> >>> initramfs.o:(panic_show_mem) in archive init/built-in.a
> >>> referenced by initramfs.c
> >>> initramfs.o:(do_collect) in archive init/built-in.a
> >>> referenced 3922 more times
> --
> >> ld.lld: error: undefined symbol: __tsan_memmove
> >>> referenced by main.c
> >>> main.o:(repair_env_string) in archive init/built-in.a
> >>> referenced by range.c
> >>> range.o:(add_range_with_merge) in archive kernel/built-in.a
> >>> referenced by core.c
> >>> bpf/core.o:(bpf_patch_insn_single) in archive kernel/built-in.a
> >>> referenced 88 more times

The fix for this has been in -next (-rcu) for a while. Once it hits
mainline, it should also reach stable kernels since I attached Cc:
stable tags to the patches.

Given Clang 16 isn't even released yet, I think this is fair and does
not require urgency at this point.

Thanks,
-- Marco