Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread Sanitizer crashes when running REPLCE_NEAR #22

Open
jiridanek opened this issue Dec 26, 2021 · 5 comments
Open

Thread Sanitizer crashes when running REPLCE_NEAR #22

jiridanek opened this issue Dec 26, 2021 · 5 comments
Labels

Comments

@jiridanek
Copy link
Contributor

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.

@coolxv
Copy link
Owner

coolxv commented Dec 27, 2021

stub-cpp is not optimized for Sanitizer.
This is only used in unit test scenarios.

@jiridanek
Copy link
Contributor Author

@coolxv I use Thread Sanitizer for unit tests. I think that putting __attribute__((no_sanitize("thread"))) on Stub::set is reasonable. I am also thinking that maybe the Sanitizer error is actually a sanitizer bug. I'll consider reporting it there.

@coolxv
Copy link
Owner

coolxv commented Dec 28, 2021

Sanitizer is the compiler that has done special processing and inserted some special statements.

@coolxv
Copy link
Owner

coolxv commented Dec 28, 2021

@jiridanek Unit tests do not need to be compiled with the sanitizer option.

@coolxv
Copy link
Owner

coolxv commented Dec 28, 2021

I'm on my machine and use attribute((no_sanitize("thread"))) on Stub::set is correct.

gcc version 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04)

@coolxv coolxv added the bug label Dec 28, 2021
@coolxv coolxv added feature and removed bug labels Jan 12, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to jiridanek/qpid-dispatch that referenced this issue Jan 29, 2022
jiridanek added a commit to apache/qpid-dispatch that referenced this issue Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants