Re: Simple program segfaults when ThreadSanitizer is enabled

Skip to first unread message

Dmitry Vyukov

May 12, 2022, 8:33:47 AM5/12/22
to Olivier Nicole, thread-sanitizer, Vitaly Buka, address-sanitizer,
On Thu, 12 May 2022 at 14:25, Olivier Nicole <> wrote:
> I forgot to mention that I use clang version 7.1.0 on Linux.

Hi Olivier,

clang 7 is too old, but this also reproduces with a fresh clang 15.
The root cause is that the C threading library not supported. I think
is equally broken for all sanitizers, they will crash or misbehave on
other programs (maybe during error reporting).

+Vitaly and asan/msan lists

> On Thursday, 12 May 2022 at 14:11:53 UTC+2 Olivier Nicole wrote:
>> Hi,
>> I tried out ThreadSanitizer on this simple program that spawns two threads:
>> The program runs fine but segfaults when instrumented by ThreadSanitizer:
>> $ clang -Wall -Wextra -pedantic -std=c11 -pthread atomic_race.c
>> $ ./a.out
>> v = 10
>> $ clang -Wall -Wextra -pedantic -std=c11 -pthread -fsanitize=thread atomic_race.c
>> $ ./a.out
>> ThreadSanitizer:DEADLYSIGNAL
>> ==205049==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000490f8a bp 0x000000000000 sp 0x7f88234bf268 T205050)
>> ==205049==The signal is caused by a WRITE memory access.
>> ==205049==Hint: address points to the zero page.
>> ThreadSanitizer:DEADLYSIGNAL
>> ThreadSanitizer:DEADLYSIGNAL
>> ThreadSanitizer: nested bug in the same thread, aborting.
>> Am I missing something?
>> Thanks,
>> Olivier
> --
> 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
> To view this discussion on the web visit
Reply all
Reply to author
0 new messages