Skip to content

Commit eb4c095

Browse files
committed
Fix suppressions for rd_avg_calc()/rd_avg_rollover() (due to static qualifier)
The problem is that TSan still fails [1] is that ignorelist does not work for static functions without asterisk: // test.cpp #include <thread> bool flag = false; // avoid mangling extern "C" { static void set_flag_impl() { flag = true; } void set_flag() { set_flag_impl(); } void set_flag_if() { if (flag) flag = false; } } int main() { std::thread t1([]{ set_flag(); }); std::thread t2([]{ set_flag_if(); }); t1.join(); t2.join(); return 0; } // ignorelist [thread] fun:set_flag_impl $ clang++ -g -fno-omit-frame-pointer -fsanitize=thread -fsanitize-ignorelist=ignorelist -o test test.cpp && ./test SUMMARY: ThreadSanitizer: data race /tmp/test-tsan-ignorelist/test.cpp:19:9 in set_flag_if $ sed -i 's/set_flag_impl/*set_flag_impl*/' ignorelist $ clang++ -g -fno-omit-frame-pointer -fsanitize=thread -fsanitize-ignorelist=ignorelist -o test test.cpp && ./test OK But, note that ignorelist is tricky, and will not work for functions with __always_inline__ attribute for example. P.S. set_flag_impl also has brackets in the output (i.e. set_flag_impl()), while ther eis brackets for rd_avg_calc on CI [1]. [1]: https://s3.amazonaws.com/clickhouse-test-reports/63039/84bebc534ba7cf6e9dbfc1d91e8350939a84f87c/integration_tests__tsan__[6_6]//home/ubuntu/actions-runner/_work/_temp/test/output_dir/integration_run_parallel4_0.log Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
1 parent 84bebc5 commit eb4c095

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

tests/tsan_ignorelist.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
# [1]: https://clang.llvm.org/docs/SanitizerSpecialCaseList.html
44
# [2]: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions
55
#
6+
# Caveats for generic entry "fun":
7+
# - does not work for __attribute__((__always_inline__))
8+
# - requires asterisk at the beginning *and* end for static functions
9+
#
610
[thread]
711
# https://github.com/ClickHouse/ClickHouse/issues/55629
812
fun:rd_kafka_broker_set_nodename
913
# https://github.com/ClickHouse/ClickHouse/issues/60443
10-
fun:rd_avg_calc
11-
fun:rd_avg_rollover
14+
fun:*rd_avg_calc*
15+
fun:*rd_avg_rollover*

tests/ubsan_ignorelist.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# See also [3] for all UBSan checks.
77
#
88
# [3]: https://github.com/llvm-mirror/compiler-rt/blob/master/lib/ubsan/ubsan_checks.inc
9+
#
10+
# Caveats for generic entry "fun":
11+
# - does not work for __attribute__((__always_inline__))
12+
# - requires asterisk at the beginning *and* end for static functions
13+
#
914
[undefined]
1015
# Some value is outside the range of representable values of type 'long' on user-provided data inside boost::geometry - ignore.
1116
src:*/Functions/pointInPolygon.cpp

0 commit comments

Comments
 (0)