Subject: Re: linux-next: Tree for Nov 19 (kcsan)

From: Randy Dunlap <[email-masked]>
Date: Tue, 19 Nov 2019 08:50:34 -0800

On 11/19/19 8:12 AM, Marco Elver wrote:
> On Tue, 19 Nov 2019 at 16:11, Randy Dunlap <[email-masked]> wrote:
>>
>> On 11/19/19 12:46 AM, Stephen Rothwell wrote:
>>> Hi all,
>>>
>>> Changes since 20191118:
>>>
>>
>> on x86_64:
>>
>> It seems that this function can already be known by the compiler as a
>> builtin:
>>
>> ../kernel/kcsan/core.c:619:6: warning: conflicting types for built-in function ‘__tsan_func_exit’ [-Wbuiltin-declaration-mismatch]
>>  void __tsan_func_exit(void)
>>       ^~~~~~~~~~~~~~~~
>>
>>
>> $ gcc --version
>> gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407]
> 
> Interesting. Could you share the .config? So far I haven't been able
> to reproduce.

Sure, it's attached.

> I can get the warning if I manually add -fsanitize=thread to flags for
> kcsan/core.c (but normally disabled via KCSAN_SANITIZE := n). If
> possible could you also share the output of `make V=1` for
> kcsan/core.c?

here:

make -C /home/rdunlap/lnx/next/linux-next-20191119/xx64 -f /home/rdunlap/lnx/next/linux-next-20191119/Makefile kernel/kcsan/core.o
make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20191119/xx64'
if [ -f ../.config -o \
	 -d ../include/config -o \
	 -d ../arch/x86/include/generated ]; then \
	echo >&2 "***"; \
	echo >&2 "*** The source tree is not clean, please run 'make ARCH=x86_64 mrproper'"; \
	echo >&2 "*** in /home/rdunlap/lnx/next/linux-next-20191119";\
	echo >&2 "***"; \
	false; \
fi
ln -fsn .. source
sh ../scripts/mkmakefile ..
  GEN     Makefile
test -e .gitignore || \
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
make -f ../scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ../scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ../scripts/Makefile.build obj=arch/x86/tools relocs
make -f ../scripts/Makefile.build obj=scripts/dtc
make -f ../scripts/Makefile.build obj=scripts
make -f ../scripts/Makefile.build obj=scripts/genksyms \
 \
need-builtin= \
need-modorder=
set -e; mkdir -p include/config/; { echo "5.4.0-rc8$(sh ../scripts/setlocalversion ..)"; } > include/config/kernel.release.tmp; if [ -r include/config/kernel.release ] && cmp -s include/config/kernel.release include/config/kernel.release.tmp; then rm -f include/config/kernel.release.tmp; else : '  UPD     include/config/kernel.release'; mv -f include/config/kernel.release.tmp include/config/kernel.release; fi
make -f ../scripts/Makefile.asm-generic obj=arch/x86/include/generated/uapi/asm \
generic=include/uapi/asm-generic
make -f ../scripts/Makefile.asm-generic obj=arch/x86/include/generated/asm \
generic=include/asm-generic
rm -f include/linux/version.h
set -e; mkdir -p include/generated/; { 	if [ `echo -n "5.4.0-rc8-next-20191119" | wc -c ` -gt 64 ]; then echo '"5.4.0-rc8-next-20191119" exceeds 64 characters' >&2; exit 1; fi; echo \#define UTS_RELEASE \"5.4.0-rc8-next-20191119\"; } > include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then rm -f include/generated/utsrelease.h.tmp; else : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp include/generated/utsrelease.h; fi
make -f ../scripts/Makefile.build obj=scripts/mod
  sh ../scripts/gen_ksymdeps.sh scripts/mod/empty.o >> scripts/mod/.empty.o.cmd
  scripts/mod/mk_elfconfig < scripts/mod/empty.o > scripts/mod/elfconfig.h
  gcc -Wp,-MD,scripts/mod/.modpost.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89       -I ./scripts/mod -c -o scripts/mod/modpost.o ../scripts/mod/modpost.c
set -e; mkdir -p scripts/mod/; { 	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; echo "#define __DEVICETABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < scripts/mod/devicetable-offsets.s; echo ""; echo "#endif"; } > scripts/mod/devicetable-offsets.h.tmp; if [ -r scripts/mod/devicetable-offsets.h ] && cmp -s scripts/mod/devicetable-offsets.h scripts/mod/devicetable-offsets.h.tmp; then rm -f scripts/mod/devicetable-offsets.h.tmp; else : '  UPD     scripts/mod/devicetable-offsets.h'; mv -f scripts/mod/devicetable-offsets.h.tmp scripts/mod/devicetable-offsets.h; fi
  gcc -Wp,-MD,scripts/mod/.file2alias.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89       -I ./scripts/mod -c -o scripts/mod/file2alias.o ../scripts/mod/file2alias.c
  gcc -Wp,-MD,scripts/mod/.sumversion.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89       -I ./scripts/mod -c -o scripts/mod/sumversion.o ../scripts/mod/sumversion.c
  gcc   -o scripts/mod/modpost scripts/mod/modpost.o scripts/mod/file2alias.o scripts/mod/sumversion.o   
make -f ../scripts/Makefile.build obj=.
set -e; mkdir -p include/generated/; { 	 echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/bounds.s; echo ""; echo "#endif"; } > include/generated/bounds.h.tmp; if [ -r include/generated/bounds.h ] && cmp -s include/generated/bounds.h include/generated/bounds.h.tmp; then rm -f include/generated/bounds.h.tmp; else : '  UPD     include/generated/bounds.h'; mv -f include/generated/bounds.h.tmp include/generated/bounds.h; fi
set -e; mkdir -p include/generated/; { echo 1000 | bc -q ../kernel/time/timeconst.bc; } > include/generated/timeconst.h.tmp; if [ -r include/generated/timeconst.h ] && cmp -s include/generated/timeconst.h include/generated/timeconst.h.tmp; then rm -f include/generated/timeconst.h.tmp; else : '  UPD     include/generated/timeconst.h'; mv -f include/generated/timeconst.h.tmp include/generated/timeconst.h; fi
set -e; mkdir -p include/generated/; { 	 echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < arch/x86/kernel/asm-offsets.s; echo ""; echo "#endif"; } > include/generated/asm-offsets.h.tmp; if [ -r include/generated/asm-offsets.h ] && cmp -s include/generated/asm-offsets.h include/generated/asm-offsets.h.tmp; then rm -f include/generated/asm-offsets.h.tmp; else : '  UPD     include/generated/asm-offsets.h'; mv -f include/generated/asm-offsets.h.tmp include/generated/asm-offsets.h; fi
  sh ../scripts/atomic/check-atomics.sh
make -f ../scripts/Makefile.build obj=scripts scripts/unifdef
make -f ../scripts/Makefile.headersinst obj=include/uapi
make -f ../scripts/Makefile.headersinst obj=arch/x86/include/uapi
make -f ../scripts/Makefile.build obj=init single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=usr single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=arch/x86 single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=kernel single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=kernel/kcsan \
 \
need-builtin=1 \
need-modorder=1
../kernel/kcsan/core.c:619:6: warning: conflicting types for built-in function ‘__tsan_func_exit’ [-Wbuiltin-declaration-mismatch]
 void __tsan_func_exit(void)
      ^~~~~~~~~~~~~~~~
In file included from ../include/linux/linkage.h:7:0,
                 from ../include/linux/kernel.h:8,
                 from ../include/asm-generic/bug.h:19,
                 from ../arch/x86/include/asm/bug.h:83,
                 from ../include/linux/bug.h:5,
                 from ../kernel/kcsan/core.c:4:
../kernel/kcsan/core.c:622:15: warning: conflicting types for built-in function ‘__tsan_func_exit’ [-Wbuiltin-declaration-mismatch]
 EXPORT_SYMBOL(__tsan_func_exit);
               ^
../include/linux/export.h:87:21: note: in definition of macro ‘___EXPORT_SYMBOL’
  extern typeof(sym) sym;      \
                     ^~~
../include/linux/export.h:128:2: note: in expansion of macro ‘__cond_export_sym_1’
  __cond_export_sym_##enabled(sym, sec, ns)
  ^~~~~~~~~~~~~~~~~~
../include/linux/export.h:126:2: note: in expansion of macro ‘___cond_export_sym’
  ___cond_export_sym(sym, sec, ns, conf)
  ^~~~~~~~~~~~~~~~~~
../include/linux/export.h:124:2: note: in expansion of macro ‘__cond_export_sym’
  __cond_export_sym(sym, sec, ns, __is_defined(__KSYM_##sym))
  ^~~~~~~~~~~~~~~~~
../include/linux/export.h:142:34: note: in expansion of macro ‘__EXPORT_SYMBOL’
 #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
                                  ^~~~~~~~~~~~~~~
../include/linux/export.h:145:29: note: in expansion of macro ‘_EXPORT_SYMBOL’
 #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
                             ^~~~~~~~~~~~~~
../kernel/kcsan/core.c:622:1: note: in expansion of macro ‘EXPORT_SYMBOL’
 EXPORT_SYMBOL(__tsan_func_exit);
 ^~~~~~~~~~~~~
  sh ../scripts/gen_ksymdeps.sh kernel/kcsan/core.o >> kernel/kcsan/.core.o.cmd
make -f ../scripts/Makefile.build obj=certs single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=mm single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=fs single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=ipc single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=security single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=crypto single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=block single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=drivers single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=sound single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=samples single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=arch/x86/power single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=net single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=lib single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=arch/x86/lib single-build=1 need-builtin=1 need-modorder=1
make -f ../scripts/Makefile.build obj=virt single-build=1 need-builtin=1 need-modorder=1
make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20191119/xx64'

-- 
~Randy
Reported-by: Randy Dunlap <[email-masked]>