During this session, we'll look at the main mechanisms used by TSan to detect errors in data sharing (aka data races).
As usual, we'll consider how the support of this sanitizer is implemented in the compiler (clang and gcc), how code generation changes when the fsanitize=thread option is enabled, and what it can lead to.
We'll also look at how TSan support is implemented from the runtime. And see why TSan uses about 10 times more address space than ASan. Do we need to re-select all the libraries used with TSan, or just include TSan only for a part of the sources, and why TSan is not compatible with ASan. Finally, can TSan catch deadlock.
The main purpose of the talk is to destroy the TSan magic. After this session, the audience will understand the main principles of TSan, how and when it can be used, and when it's useless, or even harmful.