Broken TLS support in libGL.so AKA: software-center crashed with SIGSEGV in __cxa_allocate_exception()

Bug #259219 reported by Jonathan Sieber
This bug affects 446 people
Affects Status Importance Assigned to Milestone
mesa (Ubuntu)
Fix Released
High
Chris Halse Rogers
Natty
Fix Released
High
Chris Halse Rogers
software-center (Ubuntu)
Fix Released
High
Gary Lasker
Natty
Fix Released
High
Gary Lasker

Bug Description

Binary package hint: libgl1-mesa-dri

---
Software Center error description from apport is: software-center crashed with SIGSEGV in __cxa_allocate_exception()
WORKAROUND for the software-center crash:

  Launch Software Center from the command line as:

     LD_PRELOAD=/usr/lib/libstdc++.so.6 software-center

For more details about the software-center crash, please see bug 731724.
---

The package libgl1-mesa-dri in Intrepid seems to have been compiled with the option --enable-glx-tls. This triggers a bug in src/glx/x11/glxcurrent.c :
The TLS variable __glX_tls_Context is compiled with the TLS model initial-exec, which is only ment for executables. Used in shared libraries, it can break TLS usage in other shared libraries.
One example is when libGL is linked beforce libstdc++ in another library, which is then loaded via dlopen(). In this case, the TLS variables in libstdc++ aren't properly initialized, and it will segfault when trying to allocate an exception.
I think there are 2 possible solutions:
1. Do not compile with --enabgle-glx-tls
2. Patch mesa to remove the tls-model attribute. I assume this will eat up the performance gain of TLS, since initial-exec is meant as an optimisation for apps not using the GL over dlopen directly or indirectly.

Policy information about my libGL package:
libgl1-mesa-dri:
  Installiert: 7.1~rc3-1ubuntu4
  Kandidat: 7.1~rc3-1ubuntu4
  Versions-Tabelle:
 *** 7.1~rc3-1ubuntu4 0
        500 http://de.archive.ubuntu.com intrepid/main Packages
        100 /var/lib/dpkg/status

Related branches

Revision history for this message
Bryce Harrington (bryce) wrote :

Hi jonathan-sieber,

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Can you try with the latest development release of Ubuntu? (ISOs are available from cdimage.ubuntu.com)

If it remains an issue, could you also attach a new /var/log/Xorg.0.log?
Thanks in advance.

The output of lspci -vvnn would also be worth having.

Changed in mesa:
status: New → Incomplete
Revision history for this message
Bryce Harrington (bryce) wrote :

We're closing this bug since it is has been some time with no response from the original reporter. However, if the issue still exists please feel free to reopen with the requested information. Also, if you could, please test against the latest development version of Ubuntu, since this confirms the bug is one we may be able to pass upstream for help.

Changed in mesa:
status: Incomplete → Invalid
Revision history for this message
Ulrich von Zadow (uzadow) wrote :

This bug should be reopened.

See https://www.libavg.de/wiki/index.php/Known_Linux_Installation_Issues#glibc_invalid_pointer for a description of the bug as it appears in libavg.

Here's an lspci of a user's machine (Ubuntu 9.10). I'll see if I can get the user to submit the rest of the info you requested:

00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)
00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
02:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)
15:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b4)
15:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 09)
15:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 18)

Changed in mesa (Ubuntu):
status: Invalid → Incomplete
Changed in mesa (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Ulrich von Zadow (uzadow) wrote :

Changing the status to confirmed. This is not a bug that appears on some machines. It's easily reproducable on all machines with intel graphics and Jonathan's original description sums up what's happening quite nicely.

Bryce Harrington (bryce)
tags: added: intrepid
Revision history for this message
Bryce Harrington (bryce) wrote :

[This is an automatic notification.]

Hi Jonathan,

This bug was reported against an earlier version of Ubuntu, can you
test if it still occurs on Lucid?

Please note we also provide technical support for older versions of
Ubuntu, but not in the bug tracker. Instead, to raise the issue through
normal support channels, please see:

    http://www.ubuntu.com/support

If you are the original reporter and can still reproduce the issue on
Lucid, please run the following command to refresh the report:

  apport-collect 259219

If you are not the original reporter, please file a new bug report, so
we can work with you as the original reporter instead (you can reference
bug 259219 in your report if you think it may be related):

  ubuntu-bug xorg

If by chance you can no longer reproduce the issue on Lucid or if you
feel it is no longer relevant, please mark the bug report 'Fix Released'
or 'Invalid' as appropriate, at the following URL:

  https://bugs.launchpad.net/ubuntu/+bug/259219

Changed in mesa (Ubuntu):
status: Confirmed → Incomplete
tags: added: needs-retested-on-lucid-by-june
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mesa (Ubuntu) because there has been no activity for 60 days.]

Changed in mesa (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Chase Douglas (chasedouglas) wrote :

This is still an issue. I have confirmed by running libavg games in natty.

Changed in mesa (Ubuntu):
status: Expired → Confirmed
Revision history for this message
Ulrich von Zadow (uzadow) wrote :

I'm attaching a minimal piece of code that reproduces the error.

Revision history for this message
Ulrich von Zadow (uzadow) wrote :
Revision history for this message
Ulrich von Zadow (uzadow) wrote :

Removed unneeded files from reproducer

Changed in mesa (Ubuntu):
assignee: nobody → Chris Halse Rogers (raof)
importance: Undecided → High
status: Confirmed → In Progress
Changed in software-center (Ubuntu):
importance: Undecided → High
assignee: nobody → Gary Lasker (gary-lasker)
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Set as also affects software-center, please see bug 731724 for details.

Revision history for this message
Chris Halse Rogers (raof) wrote :

It looks a lot like initial-exec is inappropriate for libGL. At least, it is incompatible with being able to dlopen libGL. However, changing initial-exec to (the most general) global-dynamic doesn't fix this.

There's additionally some hand-generated assembly in glapi, which I've patched out, but the minimal reproducing case still dies. Time to really grok the ELF TLS ABI, I guess.

Michael Vogt (mvo)
Changed in software-center (Ubuntu Natty):
status: New → Triaged
description: updated
description: updated
Revision history for this message
Julian Taylor (jtaylor) wrote :

this problem also affects ipython combined with matplotlib.
LD_PRELOAD also solves it in that case.

pasting some information from:
duplicate bug 732809
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612529
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617432

>ipython
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img=mpimg.imread('/usr/share/gdm/themes/debian-greeter/debian.png')
imgplot=plt.imshow(img)
plt.show()

effect:
segfault

Revision history for this message
GTriderXC (gtriderxc) wrote :

  .

Revision history for this message
Joe Areeda (areeda) wrote :

I see this bug on my Natty Alpha install. Ihave to do the LD_PRELOAD every time though (the work around suggests it only has to be done once).

Question: should software-center be run as root or normal user? I get different messages in the terminal window that suggest whichever one I choose is wrong.

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hi Joe, thanks for your comment.

> I see this bug on my Natty Alpha install. I have to do the LD_PRELOAD
> every time though (the work around suggests it only has to be done once).

Hmm, ok, I may have to remove that statement as it appears it may not always apply. Thanks for letting us know.

> Question: should software-center be run as root or normal user? I get
> different messages in the terminal window that suggest whichever
> one I choose is wrong.

You should run software-center as normal user, not as root.

description: updated
Revision history for this message
Mauricio Pretto (pretto) wrote :

running with the workaround command but I always get this output not sure if this is of any help.

----

mauricio@koontz:~$ LD_PRELOAD=/usr/lib/libstdc++.so.6 software-center
2011-03-11 20:58:32,897 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/pymodules/python2.7/dbus/proxies.py', 400, '_introspect_error_handler')'
2011-03-11 20:58:32,897 - dbus.proxies - ERROR - Introspect error on :1.186:/com/ubuntu/Softwarecenter: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

2011-03-11 20:58:57,933 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/share/software-center/softwarecenter/db/database.py', 154, 'open')'
2011-03-11 20:58:57,932 - root - WARNING - failed to add sca db Couldn't stat '/home/mauricio/.cache/software-center/software-center-agent.db' (No such file or directory)
/usr/share/software-center/softwarecenter/app.py:1114: Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
  self.window_main.show_all()
/usr/share/software-center/softwarecenter/SimpleGtkbuilderApp.py:50: Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
  gtk.main()
2011-03-11 20:59:13,261 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/share/software-center/softwarecenter/db/database.py', 154, 'open')'
2011-03-11 20:59:13,261 - root - WARNING - failed to add sca db Couldn't stat '/home/mauricio/.cache/software-center/software-center-agent.db' (No such file or directory)
2011-03-11 20:59:16,638 - softwarecenter.app - INFO - software-center-agent finished with status 1
----

Revision history for this message
Chris Halse Rogers (raof) wrote :

Bug update: I'm half way there - I've got it fixed for platforms without special assembly handling, and x86-64. IA32 as yet eludes me - it seems the TLS ABI docs aren't completely accurate. Or I'm mis-understanding the IA32 function call ABI. Or a bit of both :).

Revision history for this message
Aaron Broehl (abroehl) wrote : Re: [Bug 259219] Re: Broken TLS support in libGL.so
Download full text (4.3 KiB)

i'm not sure what you need me to do. i'm just testing this out and learn something new.

thanks
  _____

From: Mauricio Pretto [mailto:<email address hidden>]
To: <email address hidden>
Sent: Fri, 11 Mar 2011 18:00:02 -0600
Subject: [Bug 259219] Re: Broken TLS support in libGL.so

running with the workaround command but I always get this output not
  sure if this is of any help.

  ----

  mauricio@koontz:~$ LD_PRELOAD=/usr/lib/libstdc++.so.6 software-center
  2011-03-11 20:58:32,897 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/pymodules/python2.7/dbus/proxies.py', 400, '_introspect_error_handler')'
  2011-03-11 20:58:32,897 - dbus.proxies - ERROR - Introspect error on :1.186:/com/ubuntu/Softwarecenter: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

  2011-03-11 20:58:57,933 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/share/software-center/softwarecenter/db/database.py', 154, 'open')'
  2011-03-11 20:58:57,932 - root - WARNING - failed to add sca db Couldn't stat '/home/mauricio/.cache/software-center/software-center-agent.db' (No such file or directory)
  /usr/share/software-center/softwarecenter/app.py:1114: Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
    self.window_main.show_all()
  /usr/share/software-center/softwarecenter/SimpleGtkbuilderApp.py:50: Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
    gtk.main()
  2011-03-11 20:59:13,261 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/share/software-center/softwarecenter/db/database.py', 154, 'open')'
  2011-03-11 20:59:13,261 - root - WARNING - failed to add sca db Couldn't stat '/home/mauricio/.cache/software-center/software-center-agent.db' (No such file or directory)
  2011-03-11 20:59:16,638 - softwarecenter.app - INFO - software-center-agent finished with status 1
  ----

  --
  You received this bug notification because you are a direct subscriber
  of a duplicate bug (733468).
  https://bugs.launchpad.net/bugs/259219

  Title:
    Broken TLS support in libGL.so

  Status in “mesa” package in Ubuntu:
    In Progress
  Status in “software-center” package in Ubuntu:
    Triaged
  Status in “mesa” source package in Natty:
    In Progress
  Status in “software-center” source package in Natty:
    Triaged

  Bug description:
    Binary package hint: libgl1-mesa-dri

    ---
    Software Center error description from apport is: software-center crashed with SIGSEGV in __cxa_allocate_exception()
    WORKAROUND for the software-center crash:

      Launch Software Center from the command line as:

         LD_PRELOAD=/usr/lib/libstdc++.so.6 software-center

    For more details about the software-center crash, please see bug 731724.
    ---

    The package libgl1-mesa-dri in Intrepid seems to have been compiled with the option --enable-glx-tls. This triggers a bug in src/glx/x11/glxcurrent.c :
    T...

Read more...

Revision history for this message
Jonathan Meek (shroudedcloud) wrote : Re: Broken TLS support in libGL.so

Would this bug be the reason that USC is giving me a segmentation fault when launched from the terminal in Natty amd64 in the last week or so?

Revision history for this message
IKT (ikt) wrote :

yes

IKT (ikt)
summary: - Broken TLS support in libGL.so
+ Broken TLS support in libGL.so AKA: software-center crashed with SIGSEGV
+ in __cxa_allocate_exception()
Revision history for this message
José Lou Chang (obake) wrote :

I am getting:

software-center --debug
2011-03-13 21:18:58,243 - softwarecenter.distro - DEBUG - get_distro: 'Ubuntu'
2011-03-13 21:18:58,429 - softwarecenter.performance - DEBUG - TIME loading app.py imports: 0.263337135315
2011-03-13 21:18:58,452 - softwarecenter.app - DEBUG - query for the update-database exception 'org.freedesktop.DBus.Error.ServiceUnknown: The name com.ubuntu.Softwarecenter was not provided by any .service files' (probably ok)
Segmentation fault (core dumped)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 7.10.1-0ubuntu2

---------------
mesa (7.10.1-0ubuntu2) natty; urgency=low

  * The “stop SIGSEGVing unrelated code” upload.
  * debian/patches/113_partially_fix_tls.diff:
    - Fix TLS usage: initial-exec is not appropriate for a library that
      can be dynamically loaded with dlopen. (LP: #259219)
    - Partial patch: missing IA32 assembler dispatch code.
  * debian/rules:
    - Build without optimised assembler on i386, as we haven't fixed that
      yet. Opens LP #735188.
 -- Christopher James Halse Rogers <email address hidden> Tue, 15 Mar 2011 10:24:52 +1100

Changed in mesa (Ubuntu Natty):
status: In Progress → Fix Released
Revision history for this message
Gary Lasker (gary-lasker) wrote :

I verified that updating to libgl1-mesa-glx 7.10.1-0ubuntu2 fixes the Software Center SIGSEGV on my machine (amd64).

Thank you for your great work on this, Chris!!

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Set Fix Released for the Software Center task as well. \o/ Thanks again Chris, you rock!!

Changed in software-center (Ubuntu Natty):
status: Triaged → Fix Released
Revision history for this message
Mauricio Pretto (pretto) wrote :

working here
thanks

Revision history for this message
Paul Sladen (sladen) wrote :

mesa (7.10.1-0ubuntu2) natty; urgency=low

  * The “stop SIGSEGVing unrelated code” upload.
  * debian/patches/113_partially_fix_tls.diff:
    - Fix TLS usage: initial-exec is not appropriate for a library that
      can be dynamically loaded with dlopen. (LP: #259219)
    - Partial patch: missing IA32 assembler dispatch code.
  * debian/rules:
    - Build without optimised assembler on i386, as we haven't fixed that
      yet. Opens LP #735188.

 -- Christopher James Halse Rogers <email address hidden> Tue, 15 Mar 2011 10:24:52 +1100

Revision history for this message
Nerren (yannis-rachdi) wrote :

Working here too ! Thanks for the great work :)

Revision history for this message
Gurucharan MK (charan4u) wrote :

Hi,
I verified the fix with 7.10.1-0ubuntu2 (libegl1-mesa).
Thank you.

Revision history for this message
Konstantin (dr.dtyger) wrote : Re: [Bug 259219] Re: Broken TLS support in libGL.so AKA: software-center crashed with SIGSEGV in __cxa_allocate_exception()

Hi,

How can I apply that fix? Who could help me with it?

On Wed, Mar 16, 2011 at 12:02 AM, Paul Sladen <email address hidden> wrote:
> mesa (7.10.1-0ubuntu2) natty; urgency=low
>
>  * The “stop SIGSEGVing unrelated code” upload.
>  * debian/patches/113_partially_fix_tls.diff:
>
>  -- Christopher James Halse Rogers <email address hidden>  Tue, 15 Mar 2011
> 10:24:52 +1100

Revision history for this message
Andrea Carpineti (acarpine) wrote :

Hi Konstantin,
just upgrade your system. You can use the command:
sudo apt-get update; sudo apt-get upgrade

More details can be found at https://help.ubuntu.com/community/AptGet/Howto
If you don't update your system from a while the libgl1-mesa-glx package will be updated and this bug will be fixed (thank to Chris!!! :D ).

Revision history for this message
Nate Poell (fulminate) wrote :

I've confirmed that updating fixes this. Thank you! -Nate

On Wed, Mar 16, 2011 at 5:10 AM, Andrea Carpineti
<email address hidden>wrote:

> Hi Konstantin,
> just upgrade your system. You can use the command:
> sudo apt-get update; sudo apt-get upgrade
>
> More details can be found at
> https://help.ubuntu.com/community/AptGet/Howto
> If you don't update your system from a while the libgl1-mesa-glx package
> will be updated and this bug will be fixed (thank to Chris!!! :D ).
>
> --
> You received this bug notification because you are a direct subscriber
> of a duplicate bug (734402).
> https://bugs.launchpad.net/bugs/259219
>
> Title:
> Broken TLS support in libGL.so AKA: software-center crashed with
> SIGSEGV in __cxa_allocate_exception()
>
> Status in “mesa” package in Ubuntu:
> Fix Released
> Status in “software-center” package in Ubuntu:
> Fix Released
> Status in “mesa” source package in Natty:
> Fix Released
> Status in “software-center” source package in Natty:
> Fix Released
>
> Bug description:
> Binary package hint: libgl1-mesa-dri
>
> ---
> Software Center error description from apport is: software-center crashed
> with SIGSEGV in __cxa_allocate_exception()
> WORKAROUND for the software-center crash:
>
> Launch Software Center from the command line as:
>
> LD_PRELOAD=/usr/lib/libstdc++.so.6 software-center
>
> For more details about the software-center crash, please see bug 731724.
> ---
>
> The package libgl1-mesa-dri in Intrepid seems to have been compiled with
> the option --enable-glx-tls. This triggers a bug in src/glx/x11/glxcurrent.c
> :
> The TLS variable __glX_tls_Context is compiled with the TLS model
> initial-exec, which is only ment for executables. Used in shared libraries,
> it can break TLS usage in other shared libraries.
> One example is when libGL is linked beforce libstdc++ in another library,
> which is then loaded via dlopen(). In this case, the TLS variables in
> libstdc++ aren't properly initialized, and it will segfault when trying to
> allocate an exception.
> I think there are 2 possible solutions:
> 1. Do not compile with --enabgle-glx-tls
> 2. Patch mesa to remove the tls-model attribute. I assume this will eat up
> the performance gain of TLS, since initial-exec is meant as an optimisation
> for apps not using the GL over dlopen directly or indirectly.
>
> Policy information about my libGL package:
> libgl1-mesa-dri:
> Installiert: 7.1~rc3-1ubuntu4
> Kandidat: 7.1~rc3-1ubuntu4
> Versions-Tabelle:
> *** 7.1~rc3-1ubuntu4 0
> 500 http://de.archive.ubuntu.com intrepid/main Packages
> 100 /var/lib/dpkg/status
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/259219/+subscribe
>

Revision history for this message
Remi (boltz003) wrote :

Updating does not fixes this here, Maverick meerkat

Revision history for this message
Remi (boltz003) wrote :

Never mind

sudo apt-get update && sudo apt-get upgrade

did work for me

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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