<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - IGT's igt_reset_connectors is not signal safe"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=83498">83498</a>
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IGT's igt_reset_connectors is not signal safe
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>przanoni@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>DRM/Intel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DRI
          </td>
        </tr></table>
      <p>
        <div>
        <pre>IGT's igt_reset_connectors() is called inside a signal handler, and eventually
it calls malloc() or free() (through its libdrm calls and through the other IGT
functions), and this can lead to nice deadlocks. For more details, just do a
web search for "malloc signal handlers".

When this bug happens, the IGT application just freezes. If you attach GDB to
the process and do a backtrace, you can clearly see it is stuck inside malloc()
(or maybe free()).

So the solution would be to avoid the malloc()/free() calls inside
igt_reset_connectors() and any other possible IGT function that gets called
while in a signal handler. 

One possible solution is to modify our code to do all its allocations _before_
the signal handler happens, and then just do the necessary during the handler,
and free the associated memory later.

References:

commit a16ebccaee426ef96b0894e3af733360d88ce4d7
    igt_core: zero exit_handler_count before forking

<a href="http://lists.freedesktop.org/archives/intel-gfx/2014-September/051762.html">http://lists.freedesktop.org/archives/intel-gfx/2014-September/051762.html</a>
<a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO --- - [IVB/SNB/BYT/BDW/BSW]igt/kms_flip subcases fail and don't exit testing"
   href="show_bug.cgi?id=81367">https://bugs.freedesktop.org/show_bug.cgi?id=81367</a></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 on the CC list for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>