After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 391777 - GStreamer does not reset SEGV trap handler
GStreamer does not reset SEGV trap handler
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.3
Other Linux
: Normal critical
: 0.10.12
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-02 06:33 UTC by Aaron Bockover
Modified: 2007-01-02 06:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
Test case exposing the issue (1.02 KB, text/plain)
2007-01-02 06:35 UTC, Aaron Bockover
  Details
restore original signal handler (1.23 KB, patch)
2007-01-02 06:41 UTC, David Schleef
none Details | Review

Description Aaron Bockover 2007-01-02 06:33:47 UTC
When GStreamer is loading plugins, it traps SEGV. After it's done, it resets the handler to the default one, and not the previous one.

This leads to unhandled segfaults in Mono applications that use GStreamer, as the Mono runtime traps SEGV to translate the dereferencing of null pointers into NullReferenceExceptions. This means applications that have code to handle NullReferenceException can never recover as expected. Instead the application simply crashes.
Comment 1 Aaron Bockover 2007-01-02 06:35:20 UTC
Created attachment 79168 [details]
Test case exposing the issue

This can be compiled and run:

$ mcs TestGStreamerTrap.cs && mono TestGStreamerTrap.exe

aaron@mervperv:~/Desktop$ mono TestGStreamerTrap.exe
Attempting to throw a NullReferenceException... OK
Attempting to throw a NullReferenceException... OK
Attempting to throw a NullReferenceException... Segmentation fault

The expected output should be 4 attempts and "OK"s, meaning the SEGV handler was reset to that of the mono runtime.
Comment 2 David Schleef 2007-01-02 06:39:21 UTC
This is because GStreamer installs a SIGSEGV handler during plugin loading, but then restores the default handler.  Patch attached.
Comment 3 David Schleef 2007-01-02 06:41:13 UTC
Created attachment 79169 [details] [review]
restore original signal handler

Patch that restores original signal handler.
Comment 4 David Schleef 2007-01-02 06:42:41 UTC
Applied.

2007-01-01  David Schleef  <ds@schleef.org>

        * gst/gstplugin.c:
          Restore the previous signal handler for SIGSEGV instead of
          setting to default, since we may have stolen it away from
          someone.  (i.e., Mono)