Go Tsan check failure

Hi all,

I'm trying to build clang on Ubuntu 17.10 - the build succeeds, but
testing fails:

~/wk/LLVM/build_release$ svn info ../llvm/
Path: /home/csabaraduly/wk/LLVM/llvm
Working Copy Root Path: /home/csabaraduly/wk/LLVM/llvm
URL: https://llvm.org/svn/llvm-project/llvm/trunk
Relative URL: ^/llvm/trunk
Repository Root: https://llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 319018
Node Kind: directory
Schedule: normal
Last Changed Author: mkazantsev
Last Changed Rev: 319018
Last Changed Date: 2017-11-27 12:20:58 +0100 (Mon, 27 Nov 2017)

~/wk/LLVM/build_release$ ninja -v all check-all
[1/4] cd ~/wk/LLVM/build_release/utils/lit && /usr/bin/cmake -E
remove_directory ~/wk/LLVM/build_release/utils/lit/tests &&
/usr/bin/cmake -E copy_directory ~/wk/LLVM/llvm/utils/lit/tests
~/wk/LLVM/build_release/utils/lit/tests && /usr/bin/cmake -E copy
~/wk/LLVM/build_release/utils/lit/lit.site.cfg
~/wk/LLVM/build_release/utils/lit/tests
[2/4] cd ~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go && env
"CC=/usr/bin/cc " IN_TMPDIR=1 SILENT=1
~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go/buildgo.sh
FAILED: projects/compiler-rt/lib/tsan/CMakeFiles/GotsanRuntimeCheck
cd ~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go && env
"CC=/usr/bin/cc " IN_TMPDIR=1 SILENT=1
~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go/buildgo.sh
[3/4] cd ~/wk/LLVM/build_release/projects/compiler-rt/lib && env
LLVM_CHECKOUT=~/wk/LLVM/llvm SILENT=1 TMPDIR=
PYTHON_EXECUTABLE=/usr/bin/python2.7
COMPILER_RT=~/wk/LLVM/llvm/projects/compiler-rt
~/wk/LLVM/llvm/projects/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
ninja: build stopped: subcommand failed.

Even ninja -v resulted in SILENT=1 being passed to buildgo.sh, so I
tried to run it manually:

~/wk/LLVM/build_release$ pushd
~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go && env "CC=/usr/bin/cc
" IN_TMPDIR=1 SILENT=0
~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go/buildgo.sh
~/wk/LLVM/llvm/projects/compiler-rt/lib/tsan/go ~/wk/LLVM/build_release
/usr/bin/cc gotsan.cc -c -o
/tmp/gotsan.vYTnyXdSJU/race_linux_amd64.syso -I../rtl -I../..
-I../../sanitizer_common -I../../../include -std=c++11 -m64 -Wall
-fno-exceptions -fno-rtti -DSANITIZER_GO=1
-DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 -fPIC -ffreestanding
-Wno-maybe-uninitialized -Wno-unused-const-variable -Werror
-Wno-unknown-warning-option -DSANITIZER_DEBUG=0 -O3 -msse3
-fomit-frame-pointer
==12640==ERROR: ThreadSanitizer failed to allocate 0x4000 (16384)
bytes at address 1764aec780000 (errno: 12)
Segmentation fault (core dumped)

~/wk/LLVM/build_release$ uname -a
Linux 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux

~/wk/LLVM/build_release$ /usr/bin/cc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++
--prefix=/usr --with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib
--enable-objc-gc=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)

Is there a way to disable Go, or at least its tsan checks?

Csaba

+dvyukov

Hi,

Comments out buildgo.sh invocation from build scripts? Or you want
something else?

Hi,
I want to build clang successfully :slight_smile: I don't care about Go.

buildgo.sh is invoked directly by ninja. I don't want to modify the
(generated) build.ninja

The "SILENT=1" is hard-coded into build.ninja and ninja -v has no effect on it.

I tried passing -DLLVM_INCLUDE_GO_TESTS=OFF to cmake but the result
was the same.

Csaba

I guess there is lots of stuff that you don't care about besides
tsan/go that is built and tested during llvm build, and there is no
way to selectively disable each one of that. By design.
In the long run we need to fix all failures (please file a proper
bug). If you are looking for a temporal workaround, then comment it
out. I don't what else to suggest.

I started running into this after moving to a new machine. When building check-all, I get:

/work/llvm-6.0/llvm.src/projects/compiler-rt/lib/tsan/go/buildgo.sh: line 152: 53639 Segmentation fault

running it with SILENT=0:

cd /work/llvm-6.0/llvm.src/projects/compiler-rt/lib/tsan/go && env "CC=/usr/bin/cc " IN_TMPDIR=1 SILENT=0 /work/llvm-6.0/llvm.src/projects/compiler-rt/lib/tsan/go/buildgo.sh
/usr/bin/cc gotsan.cc -c -o /tmp/gotsan.WEnzff9pjs/race_linux_amd64.syso -I…/rtl -I…/… -I…/…/sanitizer_common -I…/…/…/include -std=c++11 -m64 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 -fPIC -ffreestanding -Wno-maybe-uninitialized -Wno-unused-const-variable -Werror -Wno-unknown-warning-option -DSANITIZER_DEBUG=0 -O3 -msse3 -fomit-frame-pointer
==54479==ERROR: ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 17923b3080000 (errno: 12)
/work/llvm-6.0/llvm.src/projects/compiler-rt/lib/tsan/go/buildgo.sh: line 152: 54479 Segmentation fault $DIR/test