<html>
    <head>
      <base href="https://bugs.freedesktop.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 - dlopen'ing libudev.so.1 from static library initializer corrupts TLS state"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91646">91646</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>dlopen'ing libudev.so.1 from static library initializer corrupts TLS state
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

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

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

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Mesa core
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>timo@rothenpieler.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is directly related to the following glibc bug:

<a href="https://sourceware.org/bugzilla/show_bug.cgi?id=15199">https://sourceware.org/bugzilla/show_bug.cgi?id=15199</a>

Something in mesa somewhere dlopens libudev.so.1 from within the early library
initializer, which causes the TLS state in glibc to get corrupted if the
application or some later library links against libudev.so.1.

The result of this is that the next time something uses a thread-local
variable, it runs into an infinite loop in tls_get_addr_tail.

As a workaround I built mesa with gallium disabled, which made it work for my
case.
The application triggering this behaviour was kodi, but everything that
directly or indirectly links against mesa and libudev is potentialy affected,
depending on the library load order.

I'm not 100% sure if this is actualy a bug in glibc, or doing dlopen from
within a static library initializer is not well defined, but it's definitely
something that needs addressing.

Encountered this with latest mesa git, never had that problem before with any
release version.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>