TSAN crashes when trying to acquire pthread_mutex_lock()

236 views
Skip to first unread message

Rajeev Sharma

unread,
Mar 25, 2015, 9:41:05 PM3/25/15
to thread-s...@googlegroups.com
Hello,

We are trying to use TSAN in our project. Unfortunately we are seeing a crash in pthread library when we integrate with tsan. Could you please let us know what could be the issue here?

Stack trace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff59453a0 in pthread_mutex_lock () from /lib64/libpthread.so.0

Thread 1 (Thread 0x7ffff6c44c80 (LWP 7276)):
#0  0x00007ffff59453a0 in pthread_mutex_lock () from /lib64/libpthread.so.0
#1  0x00007ffff5b98970 in pthread_mutex_lock () at ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2223
.
.
.
#8  0x00007ffff7d53b4d in __libc_csu_init ()
#9  0x00007ffff47edcf0 in __libc_start_main () from /lib64/libc.so.6
#10 0x00007ffff6fa6e99 in _start ()

Machine: Linux x86_64
gcc flags: -m64 -g -fPIC -pie -fsanitize=thread -fno-omit-frame-pointer -L/usr/lib/software/gnu/gcc/4.9.2/lib64/ -ltsan

Could you please let us know what could be the issue here?

Thanks,
Rajeev

Konstantin Serebryany

unread,
Mar 25, 2015, 9:43:31 PM3/25/15
to thread-s...@googlegroups.com
Does it fail only on your large application, or also on small tests?
What is the Linux distribution?
Did you try fresh clang instead of gcc?
Why do you need the last two flags?

--kcc

>
> Could you please let us know what could be the issue here?
>
> Thanks,
> Rajeev
>
> --
> You received this message because you are subscribed to the Google Groups
> "thread-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to thread-sanitiz...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Dmitry Vyukov

unread,
Mar 28, 2015, 8:31:55 AM3/28/15
to thread-s...@googlegroups.com
The program crashes in pthread_mutex_lock in libpthread.so.0. Most
likely it means that an incorrect pointer to pthread_mutex_t is passed
in, or the pthread_mutex_t object in unitialized.
Please run the program under gdb, wait till it crashes, then execute
'bt', 'disass' and 'info registers' commands and post the output here.
Reply all
Reply to author
Forward
0 new messages