[llvm-bugs] [Bug 45332] New: deadlock when forking in multithreaded application when using asan

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 27 13:59:37 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45332

            Bug ID: 45332
           Summary: deadlock when forking in multithreaded application
                    when using asan
           Product: compiler-rt
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: asan
          Assignee: unassignedbugs at nondot.org
          Reporter: adi at thingdust.com
                CC: llvm-bugs at lists.llvm.org

I updated our codebase to use clang 10 today. With the asan build, our
testsuite starts to have spurious deadlocks which happen when a forking while
another thread is in a malloc call.

The problem look very much the same as described (and fixed, but reverted
again?) here some time ago: https://reviews.llvm.org/rL304285

The callstacks looks like this:

Parent process:
* thread #7, name = 'backend', stop reason = signal SIGSTOP
  *  frame #0: 0x00007f32c1645d94 libpthread.so.0`__libc_read at read.c:26:10
     frame #1: 0x00007f32c1645d80 libpthread.so.0`__libc_read(fd=28,
buf=0x00007f32af67b620, nbytes=8) at read.c:24
     frame #2: 0x00000000002d21a0 backend`::__interceptor_read() at
sanitizer_common_interceptors.inc:1011:17
     ... [boost::process]
     frame #33: 0x00007f32c0f4fb1f libc.so.6`__clone + 63


Child process:
* thread #1, name = 'backend', stop reason = signal SIGSTOP
  * frame #0: 0x0000000000348917 backend`::internal_sched_yield() at
sanitizer_linux.cpp:422:3
    frame #1: 0x00000000002bd815 backend`::LockSlow() at sanitizer_mutex.h:54:9
    frame #2: 0x0000000000352e61 backend`::Put() [inlined] Lock at
sanitizer_mutex.h:31:5
    frame #3: 0x0000000000352e4d backend`::Put() [inlined] GenericScopedLock at
sanitizer_mutex.h:183
    frame #4: 0x0000000000352e4d backend`::Put() [inlined] alloc at
sanitizer_persistent_allocator.h:51
    frame #5: 0x0000000000352e1d backend`::Put() [inlined] PersistentAlloc at
sanitizer_persistent_allocator.h:66
    frame #6: 0x0000000000352e1d backend`::Put() at
sanitizer_stackdepotbase.h:125
    frame #7: 0x0000000000352b47 backend`::StackDepotPut() at
sanitizer_stackdepot.cpp:98:33
    frame #8: 0x00000000002bbbaa backend`::Allocate() at
asan_allocator.cpp:526:27
    frame #9: 0x00000000002bc43a backend`::asan_memalign() at
asan_allocator.cpp:952:16
    frame #10: 0x00000000003620f3 backend`::operator new() at
asan_new_delete.cpp:99:3
    frame #11: 0x00007f32c12b311d
libc++.so.1`std::__1::__libcpp_allocate(unsigned long, unsigned long) at
new:253:10
    frame #12: 0x00007f32c12b8bb0
libc++.so.1`std::__1::allocator<char>::allocate(unsigned long, void const*) at
memory:1864:37
    frame #13: 0x00007f32c12b85c6
libc++.so.1`std::__1::allocator_traits<std::__1::allocator<char>
>::allocate(std::__1::allocator<char>&, unsigned long) at memory:1581:21
    frame #14: 0x00007f32c12dffc8 libc++.so.1`std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*,
unsigned long) at string:1788:15
    frame #15: 0x00007f32c12dfbda libc++.so.1`std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char>
>::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&) at string:1840:9
    ...
    frame #58: 0x00007f32c0f4fb1f libc.so.6`__clone + 63

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200327/b8c7a64b/attachment.html>


More information about the llvm-bugs mailing list