Mir

mir_connection_get_egl_pixel_format() crashes if libEGL is loaded RTLD_LAZY

Bug #1510218 reported by Loïc Molinari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
High
Daniel van Vugt
0.17
Fix Released
High
Daniel van Vugt
mir (Ubuntu)
Fix Released
High
Unassigned

Bug Description

mir_connection_get_egl_pixel_format() crashes on Android (at least) when used in QtUbuntu. There might be some specific conditions triggering the issue there because I haven't been able to reproduce it in a standalone test [1] trying to follow the same initialisation process.

This is strange because if I directly call "eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &visual)" it works perfectly fine.

Here's a QtUbuntu branch [2] using the function.

[1] http://bazaar.launchpad.net/~loic.molinari/+junk/ubuntu-touch-test/view/head:/ubuntu-touch-test.c
[2] lp:~loic.molinari/qtubuntu/requested-surface-format-fix-use-mir_connection_get_egl_pixel_format

Related branches

summary: - mir_connection_get_egl_pixel_format() crashes on Android
+ [android] mir_connection_get_egl_pixel_format() crashes on Android
Changed in mir:
status: New → Confirmed
assignee: nobody → Alberto Aguirre (albaguirre)
milestone: none → 0.18.0
importance: Undecided → High
description: updated
description: updated
description: updated
summary: - [android] mir_connection_get_egl_pixel_format() crashes on Android
+ mir_connection_get_egl_pixel_format() crashes
Revision history for this message
Alberto Aguirre (albaguirre) wrote : Re: mir_connection_get_egl_pixel_format() crashes

It crashes under mesa too.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

I think the issue is that Qt loads platform plugins with RTLD_LAZY so the symbol eglGetConfigAttrib will be lazily resolved.

Now the the mir client platform plugins, declare eglGetConfigAttrib with a weak attribute (as mir plugins are loaded with RTLD_NOW) - so in this case case, the symbol hasn't been resolved so the mir_connection_get_egl_pixel_format resolves to calling a null function pointer.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

"with RTLD_LAZY so the symbol eglGetConfigAttrib will be lazily resolved."

Seems to be RTLD_LOCAL | RTLD_LAZY; so yeah eglGetConfigAttrib will never be resolved for the mir plugins. We should really just link against libEGL.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

We could go searching for the symbol manually at runtime, I guess?

summary: - mir_connection_get_egl_pixel_format() crashes
+ mir_connection_get_egl_pixel_format() crashes if you're not linked to
+ libEGL
Changed in mir:
importance: High → Medium
assignee: Alberto Aguirre (albaguirre) → Daniel van Vugt (vanvugt)
status: Confirmed → Triaged
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: mir_connection_get_egl_pixel_format() crashes if you're not linked to libEGL

I'm not promising a fix, because this is an intentional feature. But maybe we can improve on it...

Changed in mir:
status: Triaged → In Progress
summary: - mir_connection_get_egl_pixel_format() crashes if you're not linked to
- libEGL
+ mir_connection_get_egl_pixel_format() crashes if libEGL is loaded
+ RTLD_LAZY
Changed in mir (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

> I'm not promising a fix, because this is an intentional feature.

Do you have other nice features like that? :)

> mir_connection_get_egl_pixel_format() crashes if you're not linked to libEGL

QtUbuntu is linked to libEGL.

> Unfortunately we can't link to EGL. Because then you have:
> (a) Software clients linked to libEGL;

Wouldn't it just be the Android platform plugin that would be linked to libEGL?

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

> Wouldn't it just be the Android platform plugin that would be linked to libEGL?

(And not libmirclient)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Never mind. I've proposed a nice clean fix now that doesn't compromise by introducing dependencies.

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Cool, thanks.

Changed in mir:
importance: Medium → High
Changed in mir (Ubuntu):
importance: Medium → High
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.18.0

Changed in mir:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (152.7 KiB)

This bug was fixed in the package mir - 0.17.1+16.04.20151105.1-0ubuntu1

---------------
mir (0.17.1+16.04.20151105.1-0ubuntu1) xenial; urgency=medium

  [ Alberto Aguirre ]
  * New upstream release 0.17.1 (https://launchpad.net/mir/+milestone/0.17.1)
    - No ABI changes. Bug fix release only.
    - Bugs fixed:
      . compositing never stops when external monitor is connected
        (LP: #1499039)
      . half screen on external monitor (LP: #1511538)
      . Nested servers don't apply their display configuration at startup
        (LP: #1492269)
      . libmircookie1 package does not list libnettle as dependency
        (LP: #1513225)
      . unity-system-compositor crash, no interaction on windowed mode
        (LP: #1511095)
      . mir_connection_get_egl_pixel_format() crashes (LP: #1510218)
      . [regression] mir-client-platform-mesa-dev pkg-config file dropped
        (LP: #1509005)

  [ CI Train Bot ]
  * New rebuild forced.

mir (0.17.0+15.10.20151008.2-0ubuntu1) wily; urgency=medium

  [ Alexandros Frantzis ]
  * New upstream release 0.17.0 (https://launchpad.net/mir/+milestone/0.17.0)
    - ABI summary: Only servers and graphics drivers need rebuilding;
      . Mirclient ABI unchanged at 9
      . Mirserver ABI bumped to 35
      . Mircommon ABI unchanged at 5
      . Mirplatform ABI bumped to 11
      . Mirprotobuf ABI bumped to 3
      . Mirplatformgraphics ABI bumped to 6
      . Mirclientplatform ABI unchanged at 3
    - Enhancements:
      . Introduce libmircookie, a simple mechanism for a group of cooperating
        processes to hand out and verify difficult-to-forge timestamps to
        untrusted 3rd parties.
      . More refactorings to support renderers other than GL.
      . Add MirBlob to the client API - a tool for serializing and
        deserializing data.
      . Introduce a libinput based input platform, not yet used by default.
      . Provide a mechanism for the shell to send events on surface
        construction.
      . Provide mir::shell::DisplayConfigurationController allowing shells
        to correctly change the display configuration, notifying clients
        as appropriate.
      . New DSO versioning guide.
      . Send events pertaining to the output a surface is currently on (dpi,
        form factor, scale) to clients.
    - Bug fixes:
      . [enhancement] XMir specific documentation should live in its own
        subsection (LP: #1200114)
      . Nested servers need cursor support (LP: #1289072)
      . Mir cursor is missing/invisible until the client sets it multiple
        times (LP: #1308133)
      . [regression] Fullscreen software surfaces (like Xmir -sw) can crash
        the Mir server (LP: #1493721)
      . [usc] Mir gives up and shuts down due to input with multimonitor qtmir
        (std::exception::what: Failure sending input event) (LP: #1496069)
      . Mouse cursor disappears upon entering the surface area of a nested
        client (LP: #1496849)
      . [android] input is not dispatched when attaching an external monitor
        (LP: #1498045)
      . [android] input coordinates are scaled incorrectly when an external
        display is connected (LP: #1498540)
      . [andro...

Changed in mir (Ubuntu):
status: Triaged → Fix Released
Kevin DuBois (kdub)
Changed in mir:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.