Open
Description
I am using void Stub::set
to install my stub. The program crashes when compiled in GCC with Thread Sanitizer.
ThreadSanitizer:DEADLYSIGNAL
==4759==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000001297 (pc 0x7f5971a10868 bp 0x1000010d4a00 sp 0x7ffff03b4e90 T4759)
==4759==The signal is caused by a WRITE memory access.
#0 __tsan_write1 <null> (libtsan.so.0+0x91868)
#1 void Stub::set<int (*)(char*, unsigned long, char const*, __va_list_tag*), int (*)(char*, unsigned long, char const*, ...)>(int (*)(char*, unsigned long, char const*, __va_list_tag*), int (*)(char*, unsigned long, char const*, ...)) /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/cpp-stub/cpp_stub.h:247 (c_unittests+0x490ea4)
#2 _DOCTEST_ANON_FUNC_2 /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/c_unittests/test_terminus.cpp:88 (c_unittests+0x490ea4)
#3 doctest::Context::run() /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/c_unittests/doctest.h:6486 (c_unittests+0x458747)
#4 main /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/c_unittests/doctest.h:6571 (c_unittests+0x43b762)
#5 __libc_start_call_main <null> (libc.so.6+0x2d55f)
#6 __libc_start_main_impl <null> (libc.so.6+0x2d60b)
#7 _start <null> (c_unittests+0x43c8e4)
My guess is that the address is not instrumented correctly by TSan and that therefore it is correct to resolve this by disabling TSan instrumentation for Stub::set
. The Address Sanitizer tool is not complaining, given the exactly same code.