<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 - Program terminates with SIGBUS if running in Docker"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100432">100432</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Program terminates with SIGBUS if running in Docker
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>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>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>luka.napotnik@visionect.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=130497" name="attach_130497" title="gdb backtrace">attachment 130497</a> <a href="attachment.cgi?id=130497&action=edit" title="gdb backtrace">[details]</a></span>
gdb backtrace

I'm running a gtk3 app inside an Ubuntu docker container that load a page via
WebKit and creates a snapshot of it.

The problem I have is that in some web pages, the app would terminate with a
SIGBUS signal. I've provided an attachment with the apps backtrace.

I've eliminated gtk3 and webkit as the offending memory allocation happens
inside cairo.

I've done some browsing and found out that a pointer arithmetic in
src/cairo-image-compositor.c @ _fill_xrgb32_lerp_opaque_spans causes unaligned
memory access.

Particularly, assignments like:

*d = lerp8x4 (r->u.fill.pixel, a, *d);

and:

uint32_t *d = (uint32_t *)(r->u.fill.data + r->u.fill.stride*yy +
spans[0].x*4);

in the mentioned function seemed to be problematic as they end up being
non-aligned.

The interesting thing is that the exact same app doesn't fail on the host
system, after running it for a long time.

If interested, I can also provide a working test case in a form of a docker
image.

Software used:
- x86-64 Ubuntu 16.04.1 on host
- phusion/baseimage as container baseimage 
- Docker 1.12.3
- updated to Cairo 1.14.8 in container</pre>
        </div>
      </p>


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

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