Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Data races in itimer_thread_func reported by ThreadSanitizer
Our local environment allows running Haskell programs under ThreadSanitizer. Even though the GHC runtime and compiled Haskell code are not instrumented, ThreadSanitizer still found a bug through interceptor instrumentation. I'll try to minimize the case and create a reproducer, but in case somebody wants to look at this with just the report, here it is (mildly massaged to remove irrelevant addresses): ``` ================== WARNING: ThreadSanitizer: data race (pid=2367) Write of size 1 at 0x55986a3e4f10 by thread T1: #0 pthread_mutex_destroy llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1245:3 #1 itimer_thread_func vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:152:5 Previous atomic read of size 1 at 0x55986a3e4f10 by main thread: #0 pthread_mutex_lock llvm/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:4097:3 #1 startTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:184:5 #2 exitTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:206 #3 __libc_start_main <null> (libc.so.6+0x38bbc) Location is global 'mutex' of size 40 at 0x55986a3e4f10 Thread T1 'ghc_ticker' (tid=2369, running) created by main thread at: #0 pthread_create llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:980:3 #1 initTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:171:11 #2 __libc_start_main <null> (libc.so.6+0x38bbc) SUMMARY: ThreadSanitizer: data race vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:152:5 in itimer_thread_func ================== ================== WARNING: ThreadSanitizer: data race (pid=2367) Write of size 8 at 0x55986a3e4ee0 by thread T1: #0 pthread_cond_destroy llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1216:3 #1 itimer_thread_func vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:153:5 Previous read of size 8 at 0x55986a3e4ee0 by main thread (mutexes: write M146179626018688784): #0 pthread_cond_signal llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1202:3 #1 signalCondition vendor_src/v8_4_4/rts/posix/OSThreads.c:111:11 #2 __libc_start_main <null> (libc.so.6+0x38bbc) Location is global 'start_cond' of size 48 at 0x55986a3e4ee0 Mutex M146179626018688784 is already destroyed. Thread T1 'ghc_ticker' (tid=2369, running) created by main thread at: #0 pthread_create llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:980:3 #1 initTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:171:11 #2 __libc_start_main <null> (libc.so.6+0x38bbc) SUMMARY: ThreadSanitizer: data race vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:153:5 in itimer_thread_func ================== ThreadSanitizer: reported 2 warnings ``` <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ------------------ | | Version | 8.4.4 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Runtime System | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | dvyukov@google.com | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"Data races in itimer_thread_func reported by ThreadSanitizer","status":"New","operating_system":"","component":"Runtime System","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["dvyukov@google.com"],"type":"Bug","description":"Our local environment allows running Haskell programs under ThreadSanitizer. Even though the GHC runtime and compiled Haskell code are not instrumented, ThreadSanitizer still found a bug through interceptor instrumentation. I'll try to minimize the case and create a reproducer, but in case somebody wants to look at this with just the report, here it is (mildly massaged to remove irrelevant addresses):\r\n\r\n{{{\r\n==================\r\nWARNING: ThreadSanitizer: data race (pid=2367)\r\n Write of size 1 at 0x55986a3e4f10 by thread T1:\r\n #0 pthread_mutex_destroy llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1245:3 \r\n #1 itimer_thread_func vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:152:5 \r\n\r\n Previous atomic read of size 1 at 0x55986a3e4f10 by main thread:\r\n #0 pthread_mutex_lock llvm/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:4097:3 \r\n #1 startTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:184:5 \r\n #2 exitTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:206 \r\n #3 __libc_start_main <null> (libc.so.6+0x38bbc)\r\n\r\n Location is global 'mutex' of size 40 at 0x55986a3e4f10 \r\n\r\n Thread T1 'ghc_ticker' (tid=2369, running) created by main thread at:\r\n #0 pthread_create llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:980:3 \r\n #1 initTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:171:11 \r\n #2 __libc_start_main <null> (libc.so.6+0x38bbc)\r\n\r\nSUMMARY: ThreadSanitizer: data race vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:152:5 in itimer_thread_func\r\n==================\r\n==================\r\nWARNING: ThreadSanitizer: data race (pid=2367)\r\n Write of size 8 at 0x55986a3e4ee0 by thread T1:\r\n #0 pthread_cond_destroy llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1216:3 \r\n #1 itimer_thread_func vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:153:5 \r\n\r\n Previous read of size 8 at 0x55986a3e4ee0 by main thread (mutexes: write M146179626018688784):\r\n #0 pthread_cond_signal llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1202:3 \r\n #1 signalCondition vendor_src/v8_4_4/rts/posix/OSThreads.c:111:11 \r\n #2 __libc_start_main <null> (libc.so.6+0x38bbc)\r\n\r\n Location is global 'start_cond' of size 48 at 0x55986a3e4ee0 \r\n\r\n Mutex M146179626018688784 is already destroyed.\r\n\r\n Thread T1 'ghc_ticker' (tid=2369, running) created by main thread at:\r\n #0 pthread_create llvm/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:980:3 \r\n #1 initTicker vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:171:11 \r\n #2 __libc_start_main <null> (libc.so.6+0x38bbc)\r\n\r\nSUMMARY: ThreadSanitizer: data race vendor_src/v8_4_4/rts/posix/itimer/Pthread.c:153:5 in itimer_thread_func\r\n==================\r\nThreadSanitizer: reported 2 warnings\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
issue