staticanalysis / data-race-test

Automatically exported from code.google.com/p/data-race-test
0 stars 0 forks source link

racecheck_unittest doesn't pass under LLVM-TSan #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This issue is for tracking the state of racecheck_unittest under TSan+LLVM (see 
code.google.com/p/data-race-test/wiki/CompileTimeInstrumentation)

To link a 32-bit instrumented version of racecheck_unittest, run:

make OMIT_CPP0X=1 CXXFLAGS="-DDYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK 
\-DRACECHECK_UNITTEST_WANT_ATTRIBUTE_WEAK" 
CFLAGS="-DDYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK \
-DRACECHECK_UNITTEST_WANT_ATTRIBUTE_WEAK" CC=`pwd`/../llvm/scripts/gcc.sh 
CXX=`pwd`/../llvm/scripts/gcc.sh LD=`pwd`/../llvm/scripts/ld.sh 
AR=`pwd`/../llvm/scripts/ar.sh l32

The following tests are currently broken under LLVM:

DeathTests.* -- because the RTL needs to handle fork() correctly by restarting 
ThreadSanitizer.

PrintfTests.* -- because we don't instrument vfprintf() and friends yet (they 
belong to libc).
PositiveTests.RaceInMemcpy -- because we don't instrument memcpy (libc again)

PositiveTests.HarmfulRaceInDtor -- is possibly blocked by 
http://code.google.com/p/data-race-test/issues/detail?id=51 (two annotations 
are posted for the same address)

NegativeTests.test141 -- the test requires redundant h-b arcs between unlink() 
and fopen(). I (glider) don't find these necessary (and correct) at the moment.

NegativeTests.PerThreadTest
NegativeTests.StackReuseTests
NegativeTests.StackReuseWithFlushTests -- are possibly related. For some reason 
races are reported between two MyThread() constructors or MyThread() and 
~MyThread(). Need to investigate.

Original issue reported on code.google.com by gli...@google.com on 1 Nov 2010 at 10:40

GoogleCodeExporter commented 9 years ago
NegativeTests.StackReuseTests
NegativeTests.StackReuseWithFlushTests
-- fixed in r2560

Original comment by ramosian.glider@gmail.com on 3 Nov 2010 at 4:18

GoogleCodeExporter commented 9 years ago
NegativeTests.PerThreadTest
 -- fixed in r2563

Original comment by ramosian.glider@gmail.com on 8 Nov 2010 at 9:54

GoogleCodeExporter commented 9 years ago
PositiveTests.RaceInMemmove
PositiveTests.RaceInMemcopy
 -- fixed in r2575

In fact this has nothing to do with libc instrumentation. memcpy() is 
implemented using llvm.memmove intrinsic, which should be treated as 
llvm.memcopy

r2567 has introduced NegativeTests.BenignRaceTest, which is broken under LLVM.

Original comment by gli...@google.com on 10 Nov 2010 at 2:56

GoogleCodeExporter commented 9 years ago
NegativeTests.BenignRaceTest
 -- fixed in r2576

Original comment by gli...@google.com on 10 Nov 2010 at 4:10

GoogleCodeExporter commented 9 years ago
DeathTests.*
 -- in fact the tests are ok. ThreadSanitizer needn't be restarted.

Original comment by ramosian.glider@gmail.com on 17 Nov 2010 at 1:42

GoogleCodeExporter commented 9 years ago
IgnoreTests.DirectCallToFunR
 -- broken for TS_SERIALIZED==0 (the LLM case, too)

Original comment by ramosian.glider@gmail.com on 17 Nov 2010 at 2:25

GoogleCodeExporter commented 9 years ago
IgnoreTests.DirectCallToFunR
 -- fixed in r2696

Original comment by ramosian.glider@gmail.com on 22 Nov 2010 at 2:37

GoogleCodeExporter commented 9 years ago
PositiveTests.RepPositive*Test
 -- we miss expected races in inline assembly code. At the moment it's hard to fix it, because LLVM treats inline assembly as a function call with unknown side-effect. Handwritten assembly code in production should be annotated somehow.

Original comment by ramosian.glider@gmail.com on 22 Nov 2010 at 2:40

GoogleCodeExporter commented 9 years ago
======================================================
Updated list of tests that are broken under TSan-LLVM
======================================================

PrintfTests.* -- because we don't instrument vfprintf() and friends yet (they 
belong to libc).

PositiveTests.RepPositive*Test
 -- we miss expected races in inline assembly code. At the moment it's hard to fix it, because LLVM treats inline assembly as a function call with unknown side-effect. Handwritten assembly code in production should be annotated somehow.

NegativeTests.test141 -- the test requires redundant h-b arcs between unlink() 
and fopen(). I (glider) don't find these necessary (and correct) at the moment.

Original comment by ramosian.glider@gmail.com on 22 Nov 2010 at 2:46

GoogleCodeExporter commented 9 years ago
As of February, 2, the broken ignore files are back again and IgnoreTests.* do 
pass. We now consult ignore files at compile time.

Original comment by ramosian.glider@gmail.com on 2 Feb 2011 at 10:43

GoogleCodeExporter commented 9 years ago
Update on building stuff now:
$ CLANG=<path_to>/bin/clang
$ CUSTOM_FLAGS="-DDYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK \
  -DRACECHECK_UNITTEST_WANT_ATTRIBUTE_WEAK"
$ make CC="$CLANG" CXX="$CLANG++ -fthread-sanitizer" \
  CFLAGS="$CUSTOM_FLAGS" CXXFLAGS="$CUSTOM_FLAGS" \
  LD="$CLANG++ -fthread-sanitizer" OS=linux ARCH=amd64 ./bin/demo_tests-linux-amd64-O0

$ ./bin/demo_tests-linux-amd64-O0
-> runs some tests, segfaults on DemoTests.test313

Original comment by timurrrr on 13 Dec 2011 at 4:53

GoogleCodeExporter commented 9 years ago
Sorry, meant:
$ make CC="$CLANG -fthread-sanitizer" CXX="$CLANG++ -fthread-sanitizer" \
  CFLAGS="$CUSTOM_FLAGS" CXXFLAGS="$CUSTOM_FLAGS" \
  LD="$CLANG++ -fthread-sanitizer" OS=linux ARCH=amd64 ./bin/demo_tests-linux-amd64-O0

Original comment by timurrrr on 13 Dec 2011 at 4:53

GoogleCodeExporter commented 9 years ago
Plus:
$ make CC="$CLANG -fthread-sanitizer" CXX="$CLANG++ -fthread-sanitizer" \
  CFLAGS="$CUSTOM_FLAGS" CXXFLAGS="$CUSTOM_FLAGS" \
  LD="$CLANG++ -fthread-sanitizer" OMIT_CPP0X=1 \
  OS=linux ARCH=amd64 ./bin/racecheck_unittest-linux-amd64-O0

-> Runs some tests, segfaults on
NegativeTests.Barrier

Original comment by timurrrr on 13 Dec 2011 at 5:20