Re: Simple program segfaults when ThreadSanitizer is enabled

27 views
Skip to first unread message

Dmitry Vyukov

unread,
May 12, 2022, 8:33:47 AM5/12/22
to Olivier Nicole, thread-sanitizer, Vitaly Buka, address-sanitizer, memory-s...@googlegroups.com
On Thu, 12 May 2022 at 14:25, Olivier Nicole <oli...@tarides.com> 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: https://gist.github.com/OlivierNicole/20c6d58de1b773174a9bc093afb0cc09
>>
>> 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 thread-sanitiz...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/thread-sanitizer/cf72cdb2-20c1-40ce-9829-06f5ba063d5an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages