chanyancheung / data-race-test

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

TSanPIN on Linux doesn't intercept some functions #76

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run TSanPIN on Linux on tests:
 * NegativeTests.LibcStringFunctions
 * PositiveTests.LibcStringFunctions
with --show-expected-races

What is the expected output? What do you see instead?
NegativeTests produces false positives:
==31534== WARNING: Possible data race during read of size 1 at 0xc718113: {{{
==31534==    T207 (L{}):
==31534==     #0  __nss_hosts_lookup /lib/libc.so.6
==31534==     #1  LibcStringFuncitonsTests::CheckStrchrResult 
/usr/include/string.h:222
==31534==     #2  MyThread::ThreadBody 
/mnt/data/build/slave/full_linux_build/build/unittest/thread_wrappers_pthread.h:
341
==31534==     #3  start_thread /lib/libpthread.so.0
==31534==   Concurrent write(s) happened at (OR AFTER) these points:
==31534==    T206 (L{}):
==31534==     #0  LibcStringFuncitonsTests::WriteD 
/mnt/data/build/slave/full_linux_build/build/unittest/racecheck_unittest.cc:8312
==31534==     #1  MyThread::ThreadBody 
/mnt/data/build/slave/full_linux_build/build/unittest/thread_wrappers_pthread.h:
341
==31534==     #2  start_thread /lib/libpthread.so.0
==31534==    Race verifier data: 0x2b41916de348,0x406b24
==31534== }}}

Postive tests pass, but reports also look strange:
==24770== WARNING: Expected data race during write of size 1 at 0xc72b0d1: {{{
==24770==    T38 (L{}):
==24770==     #0  memcpy /lib/libc.so.6
==24770==     #1  LibcStringFuncitonsTests::CheckMemcpyResult 
/home/samsonov/tsan/drt/unittest/racecheck_unittest.cc:8347
==24770==     #2  MyThread::ThreadBody 
/home/samsonov/tsan/drt/unittest/thread_wrappers_pthread.h:341
==24770==     #3  start_thread /lib/libpthread.so.0
==24770==   Concurrent write(s) happened at (OR AFTER) these points:
==24770==    T37 (L{}):
==24770==     #0  LibcStringFuncitonsTests::WriteB 
/home/samsonov/tsan/drt/unittest/racecheck_unittest.cc:8304
==24770==     #1  MyThread::ThreadBody 
/home/samsonov/tsan/drt/unittest/thread_wrappers_pthread.h:341
==24770==     #2  start_thread /lib/libpthread.so.0
==24770==  Description: "expected race"
==24770==    Race verifier data: 0x7f656adb3c90,0x42056f
==24770== }}}

Seems that libc implementations are used, not the replacements (libc is likely 
to produce false positives).

A. TSan-PIN-Linux build is broken now.
B. No problem on Windows.

Original issue reported on code.google.com by samso...@google.com on 3 Oct 2011 at 4:24