Mir

Merge lp://qastaging/~raof/mir/mir-module-throw-exception into lp://qastaging/mir

Proposed by Chris Halse Rogers
Status: Work in progress
Proposed branch: lp://qastaging/~raof/mir/mir-module-throw-exception
Merge into: lp://qastaging/mir
Diff against target: 364 lines (+267/-11)
7 files modified
include/test/mir/test/doubles/null_platform.h (+0/-5)
src/common/sharedlibrary/CMakeLists.txt (+4/-1)
src/common/sharedlibrary/module_throw_exception.cpp (+94/-0)
src/common/symbols.map (+1/-0)
src/include/common/mir/module_throw_exception.h (+69/-0)
tests/acceptance-tests/test_server_shutdown.cpp (+15/-1)
tests/mir_test_framework/platform_graphics_throw.cpp (+84/-4)
To merge this branch: bzr merge lp://qastaging/~raof/mir/mir-module-throw-exception
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing
Mir development team Pending
Review via email: mp+292467@code.qastaging.launchpad.net

Commit message

Add MIR_MODULE_THROW_EXCEPTION.

This is like BOOST_THROW_EXCEPTION, but it additionally ensures that the dynamic library
that contains the throwing code is not unloaded before exception processing finishes.

This prevents annoying-to-debug SIGSEGVs when throwing an exception from a platform module
and stack unwinding causes the mir::UniqueModulePtr to be destroyed (and the DSO unloaded)
before the catch {} attempts to access code (such as destructors) or data (such as
static strings) from the now-unloaded DSO with hilarious consequences!

Description of the change

Add MIR_MODULE_THROW_EXCEPTION.

This is like BOOST_THROW_EXCEPTION, but it additionally ensures that the dynamic library
that contains the throwing code is not unloaded before exception processing finishes.

This prevents annoying-to-debug SIGSEGVs when throwing an exception from a platform module
and stack unwinding causes the mir::UniqueModulePtr to be destroyed (and the DSO unloaded)
before the catch {} attempts to access code (such as destructors) or data (such as
static strings) from the now-unloaded DSO with hilarious consequences!

Part of the infrastructure required to fix https://bugs.launchpad.net/ubuntu/+source/unity-system-compositor/+bug/1553549

I ran into this with graphics-eglstream. This, not anything the nvidia driver was doing, was the reason that all my exceptions caused SIGSEGV within libstdc++!

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
3470. By Chris Halse Rogers

Babysit g++5 by explicitly using std::hash<uint32_t>.

I don't really know why g++5 can't handle std::unordered_map<MyEnumClass, bool> while g++6 can,
but that's apparently the case.

Make life easier on poor little g++5

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3470
https://mir-jenkins.ubuntu.com/job/mir-ci/882/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/908/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/945
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/936
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/936
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/918/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/918/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/918/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/918/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/918
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/918/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/918/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/882/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

3470. By Chris Halse Rogers

Babysit g++5 by explicitly using std::hash<uint32_t>.

I don't really know why g++5 can't handle std::unordered_map<MyEnumClass, bool> while g++6 can,
but that's apparently the case.

Make life easier on poor little g++5

3469. By Chris Halse Rogers

Use MIR_MODULE_THROW_EXCEPTION in graphics-throw.so

3468. By Chris Halse Rogers

Add MIR_MODULE_THROW_EXCEPTION.

This is like BOOST_THROW_EXCEPTION, but it additionally ensures that the dynamic library
that contains the throwing code is not unloaded before exception processing finishes.

This prevents annoying-to-debug SIGSEGVs when throwing an exception from a platform module
and stack unwinding causes the mir::UniqueModulePtr to be destroyed (and the DSO unloaded)
before the catch {} attempts to access code (such as destructors) or data (such as
static strings) from the now-unloaded DSO with hilarious consequences!

3467. By Chris Halse Rogers

Test exception-safety of all mg::Platform methods.

Spoiler: only the constructor is exception-safe. All other methods SIGSEGV trying to run
code or load data found in the DSO that's just been unloaded...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches