[PATCH] D23107: [MSAN][MIPS] Fix fork.cc test on MIPS

Sagar Thakur via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 24 03:15:33 PST 2016


slthakur added a comment.

> This test is for the ChainedOriginDepotLockAll() logic in msan_interceptors.cc. Could you verify that the fork interceptor is being used on MIPS? I wonder if we need to intercept something else, like vfork.

The fork call is being intercepted by the runtime MIPS.

In order to find the root cause of this bug I debugged fork.cc on x86 (as gdb on mips was unable to give a proper backtrace from the point of deadlock) with the fast unwinder disabled (the deadlock appears only when fast unwinder is disabled and slow unwinder is used instead). Following is the stack trace from the point of deadlock on x86:

> #0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
>  #1  0x00007fbdeaaa7e92 in __GI___pthread_mutex_lock ( mutex=0x7fbdeb56c970 <_rtld_global+2352>) at ../nptl/pthread_mutex_lock.c:115
>  #2  0x00007fbdea1f542f in __GI___dl_iterate_phdr ( callback=0x437630 <msan_dl_iterate_phdr_cb(__sanitizer::__sanitizer_dl_phdr_info*, SIZE_T, void*)>, data=0x7ffdaaaaca60) at dl-iteratephdr.c:41
>  #3  0x00000000004269fc in __interceptor_dl_iterate_phdr (callback=0x7fbdea48cdf0, data=0x7ffdaaaaca90) at /home/slt/LLVM/llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1430
>  #4  0x00007fbdea48e16e in _Unwind_Find_FDE () from /lib/x86_64-linux-gnu/libgcc_s.so.1
>  #5  0x00007fbdea48ab63 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
>  #6  0x00007fbdea48bd80 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
>  #7  0x00007fbdea48c638 in _Unwind_Backtrace () from /lib/x86_64-linux-gnu/libgcc_s.so.1
>  #8  0x00000000004895c3 in __sanitizer::BufferedStackTrace::SlowUnwindStack ( this=0x7ffdaaaad040, pc=pc at entry=4790675, max_depth=max_depth at entry=20) at /home/slt/LLVM/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:125
>  #9  0x000000000048641a in __sanitizer::BufferedStackTrace::Unwind ( this=this at entry=0x7ffdaaaad040, max_depth=max_depth at entry=20, pc=pc at entry=4790675,  bp=bp at entry=140727466776720, context=context at entry=0x0, stack_top=stack_top at entry=0,  stack_bottom=0, request_fast_unwind=true) at /home/slt/LLVM/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:76
>  #10 0x000000000041be78 in __msan::GetStackTrace (request_fast_unwind=true, bp=140727466776720, pc=4790675, max_s=20, stack=0x7ffdaaaad040) at /home/slt/LLVM/llvm/projects/compiler-rt/lib/msan/msan.cc:226
>  #11 __msan_chain_origin (id=2147483648) at /home/slt/LLVM/llvm/projects/compiler-rt/lib/msan/msan.cc:562
>  #12 0x0000000000491993 in child () at /home/slt/LLVM/llvm/projects/compiler-rt/test/msan/fork.cc:60
>  #13 test () at /home/slt/LLVM/llvm/projects/compiler-rt/test/msan/fork.cc:80
>  #14 0x00000000004924b4 in main () at /home/slt/LLVM/llvm/projects/compiler-rt/test/msan/fork.cc:91

>From this backtrace, it looks like the deadlock is in libunwind where dl_interate_phdr is waiting on a lock.


Repository:
  rL LLVM

https://reviews.llvm.org/D23107





More information about the llvm-commits mailing list