<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLDB stops on every call to dlopen() when the process has additional threads running under kernel 4.20"
   href="https://bugs.llvm.org/show_bug.cgi?id=40609">40609</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB stops on every call to dlopen() when the process has additional threads running under kernel 4.20
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>frank.praznik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21436" name="attach_21436" title="Reproduction case that stops when calling dlopen()">attachment 21436</a> <a href="attachment.cgi?id=21436&action=edit" title="Reproduction case that stops when calling dlopen()">[details]</a></span>
Reproduction case that stops when calling dlopen()

Since updating to Linux kernel 4.20, if a program is run under LLDB and calls
dlopen() after spawning additional process threads LLDB will stop on every call
to dlopen() with the reason "shared-library-event", even though
target.process.stop-on-sharedlibrary-events is set to false.  Attempts to
continue results in additional stops with the reason being either additional
shared-library-events or SIGSTOP.  If halting on SIGSTOP is disabled in LLDB,
the program will eventually complete the dlopen() call successfully and run
normally.  Calling dlopen() from a single-threaded program results in no
issues.

This only occurs under kernel 4.20. When running the same program under kernel
4.19 no issues are exhibited.  GDB doesn't stop under the same conditions and
the test program shows no errors with the various Clang sanitizers or Valgrind.
 I've reproduced this on two separate machines with both the stable LLDB 7.0.1
as well as a recent build of the trunk.

The output of LLDB when running a small reproduction case (included as an
attachment), which spawns a single thread and loads a minimal shared library,
is as follows:

(lldb) target create "lldb_stop"
Current executable set to 'lldb_stop' (x86_64).
(lldb) settings show target.process.stop-on-sharedlibrary-events
target.process.stop-on-sharedlibrary-events (boolean) = false
(lldb) r
Process 11913 launched: '/home/franz/Documents/lldbrep/lldb_stop' (x86_64)
Creating thread...
Thread successfully created
Loading shared library...
Process 11913 stopped
* thread #1, name = 'lldb_stop', stop reason = shared-library-event
    frame #0: 0x00007ffff7fe23e0 ld-2.28.so`__GI__dl_debug_state
ld-2.28.so`__GI__dl_debug_state:
->  0x7ffff7fe23e0 <+0>: endbr64 
    0x7ffff7fe23e4 <+4>: retq   

ld-2.28.so`.annobin_dl_debug.c:
    0x7ffff7fe23e5 <+5>: nopw   %cs:(%rax,%rax)

ld-2.28.so`_dl_debug_initialize:
    0x7ffff7fe23f0 <+0>: endbr64 
  thread #2, name = 'lldb_stop', stop reason = signal SIGSTOP
    frame #0: 0x00007ffff7f920c6 libpthread.so.0`do_futex_wait.constprop.1 + 54
libpthread.so.0`do_futex_wait.constprop.1:
->  0x7ffff7f920c6 <+54>: cmpq   $-0x1000, %rax            ; imm = 0xF000 
    0x7ffff7f920cc <+60>: ja     0x7ffff7f920e8            ; <+88>
    0x7ffff7f920ce <+62>: movl   %r12d, %edi
    0x7ffff7f920d1 <+65>: callq  0x7ffff7f92aa0            ;
__pthread_disable_asynccancel</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>