TSAN algorithm

63 views
Skip to first unread message

Ibraim Ganiev

unread,
Nov 12, 2018, 2:42:00 PM11/12/18
to thread-sanitizer
Hi everyone,
I wanted to ask if there is a good explanation of how TSAN works. I tried to read https://github.com/google/sanitizers/wiki/ThreadSanitizerAlgorithm but it seems too vague. I tried to search for some additional info but somehow I can find articles only about old valgrind-based implementation. I'm just curious, and want to know more details. Could you point me on any article/docs about TSAN algorithm used in current implementation?

Also, I have another question: I know that helgrind/drd are still sensetive to "wrong" omp binaries. So you have to compile libgomp with special option to turn off futex-based synchronization, because helgrind/drd does not perceive futex-based synchronization as a synchronization and produces a lot of false-positives if gomp is built with it. Does TSAN have similar limitations?

Thanks in advance.

i.haniiev

unread,
Nov 12, 2018, 4:50:29 PM11/12/18
to thread-s...@googlegroups.com
Hi everyone,
I wanted to ask if there is a good explanation of how TSAN works. I
tried to read
https://github.com/google/sanitizers/wiki/ThreadSanitizerAlgorithm but
it seems too vague. I tried to google but somehow I can find articles
only about old valgrind-based implementation. I'm just curious, and want
to know more details. Could you point me on any article/docs about TSAN
algorithm?

Also, I have another question: I know that helgrind/drd are still
sensetive to "wrong" omp binaries. So you have to compile libgomp with
special option to turn off futex-based synchronization, because
helgrind/drd does not perceive futex-based synchronization as a
synchronization and produces a lot of false-positives if gomp is built
with it. Does TSAN have similar limitations?

Thanks in advance,
Ibraim Ganiev.

Dmitry Vyukov

unread,
Nov 17, 2018, 12:23:46 AM11/17/18
to thread-s...@googlegroups.com
On Mon, Nov 12, 2018 at 11:42 AM, Ibraim Ganiev <olol...@gmail.com> wrote:
> Hi everyone,
> I wanted to ask if there is a good explanation of how TSAN works. I tried to
> read https://github.com/google/sanitizers/wiki/ThreadSanitizerAlgorithm but
> it seems too vague. I tried to search for some additional info but somehow I
> can find articles only about old valgrind-based implementation. I'm just
> curious, and want to know more details. Could you point me on any
> article/docs about TSAN algorithm used in current implementation?

Hi Ibraim,

Here are some videos and presentations about tsan internals:

https://www.infoq.com/presentations/go-race-detector
https://github.com/google/sanitizers/wiki/ThreadSanitizerAlgorithm
http://cpp-russia.ru/?page_id=591
https://gcc.gnu.org/wiki/cauldron2012?action=AttachFile&do=get&target=kcc.pdf

But of course code is the ultimate source of truth :)

> Also, I have another question: I know that helgrind/drd are still sensetive
> to "wrong" omp binaries. So you have to compile libgomp with special option
> to turn off futex-based synchronization, because helgrind/drd does not
> perceive futex-based synchronization as a synchronization and produces a lot
> of false-positives if gomp is built with it. Does TSAN have similar
> limitations?

Tsan requires all source code to be built with tsan enabled. E.g.
libgomp needs to be built with tsan too. As far as I remember this
worked, you can find some historical info re libgomp here:
https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=tsan%20libgomp
Reply all
Reply to author
Forward
0 new messages