altamimi513 / data-race-test

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

fun_r doesn't work properly (probably due to tailcalls) #63

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
http://build.chromium.org/p/client.tsan/builders/buildbot-mac/builds/3967/steps/
test_2/logs/stdio
NegativeTests.GetAddrInfoTest
...
==21165== WARNING: Possible data race during read of size 1 at 0xDF10AF0: {{{
==21165==    T2401 (L{}):
==21165==     #0  Replace_memcpy 
/b/build/slave/full_mac/build/valgrind.5MP9Qb/lib/valgrind/vgpreload_tsan-debug-
x86-darwin.so
==21165==     #1  memcpy 
/b/build/slave/full_mac/build/valgrind.5MP9Qb/lib/valgrind/vgpreload_tsan-debug-
x86-darwin.so
==21165==     #2  si_addrinfo_list_from_hostent /usr/lib/libSystem.B.dylib
==21165==     #3  _mdns_addrinfo /usr/lib/libSystem.B.dylib
==21165==     #4  search_addrinfo /usr/lib/libSystem.B.dylib
==21165==     #5  si_addrinfo /usr/lib/libSystem.B.dylib
==21165==     #6  getaddrinfo /usr/lib/libSystem.B.dylib
==21165==     #7  NegativeTests_GetAddrInfoTest::Worker() 
unittest/bin/racecheck_unittest-darwin-x86-O1
==21165==     #8  ThreadSanitizerStartThread 
/b/build/slave/full_mac/build/valgrind.5MP9Qb/lib/valgrind/vgpreload_tsan-debug-
x86-darwin.so
==21165==   Concurrent write(s) happened at (OR AFTER) these points:
==21165==    T2400 (L{L65866}):
==21165==     #0  memcpy 
/b/build/slave/full_mac/build/valgrind.5MP9Qb/lib/valgrind/vgpreload_tsan-debug-
x86-darwin.so
==21165==     #1  _mdns_hostent_append_addr /usr/lib/libSystem.B.dylib
==21165==     #2  _mdns_query_callback /usr/lib/libSystem.B.dylib
==21165==     #3  handle_query_response /usr/lib/libSystem.B.dylib
==21165==     #4  DNSServiceProcessResult /usr/lib/libSystem.B.dylib
==21165==     #5  dyld::fastBindLazySymbol(ImageLoader**, unsigned long) 
/usr/lib/dyld
==21165==     #6  dyld_stub_binder_ /usr/lib/libSystem.B.dylib
==21165==     #7  _mdns_query_mDNSResponder /usr/lib/libSystem.B.dylib
==21165==     #8  _mdns_search /usr/lib/libSystem.B.dylib
==21165==     #9  _mdns_addrinfo /usr/lib/libSystem.B.dylib

Please note that both accesses are below getaddrinfo which is fun_r'ed.
This is likely due to some tailcalls?

Also, it's strange that memcpy in the "concurrent" access is not wrapped (or is 
it?)

Original issue reported on code.google.com by timurrrr on 29 Mar 2011 at 1:40

GoogleCodeExporter commented 8 years ago
Also happens on Linux, good repro is here: (against r3260)
diff --git tsan/thread_sanitizer.cc tsan/thread_sanitizer.cc
index 47c3971..dccdea7 100644
--- tsan/thread_sanitizer.cc
+++ tsan/thread_sanitizer.cc
@@ -8137,7 +8137,8 @@ static void SetupIgnore() {
   g_ignore_lists->ignores.push_back(IgnoreFun("_setjmp"));
   g_ignore_lists->ignores.push_back(IgnoreFun("_longjmp_unwind"));

-  g_ignore_lists->ignores.push_back(IgnoreFun("__mktime_internal"));
+  g_ignore_lists->ignores_r.push_back(IgnoreFun("__mktime_internal"));
+  g_ignore_lists->ignores_r.push_back(IgnoreFun("mktime"));

   // http://code.google.com/p/data-race-test/issues/detail?id=40
   g_ignore_lists->ignores_r.push_back(IgnoreFun("_ZNSsD1Ev"));
diff --git unittest/posix_tests.cc unittest/posix_tests.cc
index fff1197..d428fee 100644
--- unittest/posix_tests.cc
+++ unittest/posix_tests.cc
@@ -1232,7 +1232,7 @@ void Worker2() {
 // Disabled because fun_r:mktime and fun_r:__mktime_internal don't suppress
 // the reports below mktime
 // http://code.google.com/p/data-race-test/issues/detail?id=63
-TEST(NegativeTests, DISABLED_MktimeTest) {
+TEST(NegativeTests, MktimeTest) {
   MyThreadArray t(Worker2, Worker2);
   t.Start();
   t.Join();
-----------------------------------------------------
We need a way to fun_r in such scenarious...

Original comment by timurrrr on 31 Mar 2011 at 9:29