[PATCH] D39619: Correct atexit(3) support in TSan/NetBSD

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 23:39:47 PST 2017


On Thu, Nov 9, 2017 at 1:09 AM, Kamil Rytarowski <n54 at gmx.com> wrote:
> On 08.11.2017 17:42, Dmitry Vyukov wrote:
>> On Wed, Nov 8, 2017 at 5:29 PM, Kamil Rytarowski via Phabricator
>> <reviews at reviews.llvm.org> wrote:
>>> krytarowski added a comment.
>>>
>>> Thanks for review, I will commit it tonight!
>>>
>>> The remaining problems with TSan/NetBSD:
>>>
>>> - Mutex tracking is broken, they seem to be not registered (in ScopedReport::AddMemoryAccess we always get mset->Size() equal to 0)
>>
>>
>> This is strange.
>> If pthread_mutex/spinlock, etc interceptors work, then it should be
>> enough for mset's to work. The interceptors call
>> MutexPre/PostLock/Unlock and from that point everything is
>> platform-independent.
>>
>
> Could you please set a breakpoint in the place when we increase mset (so
> Size() is > 0) and share backtrace (with __FILE__:__LINE__)? This will
> help to narrow down the problem for me.
>
> I have an access to Clang 3.9/Linux that predates Pre/Post Lock split
> and so far I don't see anything wrong on my side.


It goes straight from the pthread interceptors:

Breakpoint 1, __tsan::MutexSet::Add (this=this at entry=0x7ffff4bbfca0,
id=1125899929169784,
    write=write at entry=true, epoch=8198)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_mutexset.cc:27
27   for (uptr i = 0; i < size_; i++) {
(gdb) bt
#0  __tsan::MutexSet::Add (this=this at entry=0x7ffff4bbfca0, id=1125899929169784,
    write=write at entry=true, epoch=8198)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_mutexset.cc:27
#1  0x00000000004ab8a3 in __tsan::MutexPostLock (thr=thr at entry=0x7ffff4bbfbc0,
    pc=pc at entry=4598437, addr=addr at entry=22327160, flagz=flagz at entry=0,
    rec=<optimized out>, rec at entry=1)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc:192
#2  0x0000000000462c46 in __interceptor_pthread_mutex_lock (m=0x154af78 <mtx>)
    at ../projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:3807
#3  0x00000000004b7080 in Thread1 (x=0x0) at ./mutexset1.cc:9
#4  0x0000000000444a0e in __tsan_thread_start_func (arg=0x7fffffffd8d0)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:933
#5  0x00007ffff75ba184 in start_thread (arg=0x7ffff4bff700) at
pthread_create.c:312
#6  0x00007ffff6cc4ffd in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:111


More information about the llvm-commits mailing list