Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118524

Crash in wayland when using Bubblewrap container plugin

    XMLWordPrintable

Details

    • Linux/Yocto
    • 6dd357386 (dev)

    Description

      Actual behavior
      By default bubblewrap container plugin is unsharing all namespaces, but unsharing pid namespace leads to crash in creating th EGL Context for WaylandClient:

      Oct 10 20:33:22 imx8mp start.sh[2505]: [WARN | am.qml] Object or context destroyed during incubation
      Oct 10 20:33:34 imx8mp start.sh[2505]: [DBG  | default] Systemd keepalive tick sent [WatchdogNotifier.cpp:71]
      Oct 10 20:33:34 imx8mp start.sh[2505]: [DBG  | qml] Systemd notified [MainView.qml:184]
      Oct 10 20:33:49 imx8mp start.sh[2505]: [DBG  | default] Systemd keepalive tick sent [WatchdogNotifier.cpp:71]
      Oct 10 20:33:49 imx8mp start.sh[2505]: [DBG  | qml] Systemd notified [MainView.qml:184]
      Oct 10 20:33:55 imx8mp start.sh[2505]: [DBG  | qml] applicationRunStateChanged id: ### state:1 [***Application.qml:63]
      Oct 10 20:33:56 imx8mp start.sh[2552]: *** process /usr/bin/appman-launcher-qml (2) crashed ***
      Oct 10 20:33:56 imx8mp start.sh[2552]:  > why: uncaught signal 11 (Segmentation fault)
      Oct 10 20:33:56 imx8mp start.sh[2552]:  > where: main thread, TID: 2, pthread ID: ffff8c93a020
      Oct 10 20:33:56 imx8mp start.sh[2552]:  > Your binary is built in release mode. The following backtrace might be inaccurate.
      Oct 10 20:33:56 imx8mp start.sh[2552]:  > Please consider using a debug build for a more accurate backtrace.
      Oct 10 20:33:56 imx8mp start.sh[2552]:  > C++ backtrace:
      Oct 10 20:33:59 imx8mp start.sh[2552]:    0: ? [ffff88c3a4bb]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    1: ? [ffff88c3e03b]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    2: gco3D_Construct [ffff88c032b3]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    3: ? [ffff89a898c3]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    4: ? [ffff89a4e8f3]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    5: ? [ffff8999bf67]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    6: eglCreateContext [ffff8999cc0b]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    7: QEGLPlatformContext::QEGLPlatformContext(QSurfaceFormat const&, QPlatformOpenGLContext*, void*, void**, QFlags<QEGLPlatformContext::Flag>) [ffff8b0a5e0f]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    8: QtWaylandClient::QWaylandGLContext::QWaylandGLContext(void*, QtWaylandClient::QWaylandDisplay*, QSurfaceFormat const&, QPlatformOpenGLContext*) [ffff8429a1ff]
      Oct 10 20:33:59 imx8mp start.sh[2552]:    9: QtWaylandClient::QWaylandEglClientBufferIntegration::createPlatformOpenGLContext(QSurfaceFormat const&, QPlatformOpenGLContext*) const [ffff84298d7b]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   10: QtWaylandClient::QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext*) const [ffff8b33de3f]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   11: QOpenGLContext::create() [ffff8afea19f]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   12: QtAM::SharedMain::setupOpenGL(QMap<QString, QVariant> const&) [aaaab6478307] in /home/pno/work/***/qtapplicationmanager/src/shared-main-lib/sharedmain.cpp:225
      Oct 10 20:33:59 imx8mp start.sh[2552]:   13: main [aaaab6401b27] in /home/pno/work/***/qtapplicationmanager/src/tools/launcher-qml/launcher-qml.cpp:128
      Oct 10 20:33:59 imx8mp start.sh[2552]:   14: ? [ffff8a1eb22f]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   15: __libc_start_main [ffff8a1eb30b]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   16: _start [aaaab64027af]
      Oct 10 20:33:59 imx8mp start.sh[2552]:   17: ? [ffffffffffffffff]
      
      

      The fix for that seems to be to unshare all beside pid namespace:

      -    m_bwrapArguments += u"--unshare-all"_s;
      -    if (!m_unshareNetwork)
      +    if (!m_unshareNetwork) {
               m_bwrapArguments += u"--share-net"_s;
      +    } else {
      +        m_bwrapArguments += u"--unshare-net"_s;
      +    }
      +    m_bwrapArguments += u"--unshare-user"_s;
      +    m_bwrapArguments += u"--unshare-ipc"_s;
      +    m_bwrapArguments += u"--unshare-uts"_s;
      +    m_bwrapArguments += u"--unshare-cgroup"_s; 

      Expected behavior

      Unsharing all namespaces shall not lead to crash while starting the application, alternatively bubblewrapcontainer plugin shall allow for better finetune of resharing some namespaces if unshare all option is selected (which is by default) in the same way it allows to re-share the `net` namespace.

      Attachments

        For Gerrit Dashboard: QTBUG-118524
        # Subject Branch Project Status CR V

        Activity

          People

            rgriebl Robert Griebl
            prnogaj Przemyslaw Nogaj
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes