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

SIGSEGV in init sequence - efence or duma libraries say QByteArray::append(char) is at fault



    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Invalid
    • Affects Version/s: 5.7.0
    • Fix Version/s: None
    • Labels:
    • Environment:


      In the process of identifying the cause of some SIGSEGVs in a desktop application, I tried efence (http://elinux.org/Electric_Fence) then duma (http://duma.sourceforge.net/). To my surprise, linking against any of them causes a SIGSEGV during the init sequence and the core dump accuses `QByteArray::append(char)` as the culprit.

      Note: I'm not interested in memleaks and the actual app I need diagnosis is multithreaded (I suspect race conditions) - therefore I skipped valgrind/memcheck for efence/duma.

      To avoid any negative interference with the code in the app (statics and whatnot), I decided to test efence/duma with an empty application. Double surprise, the issue persists.

      *Brief of environment:* Ubuntu 14.04, gcc 5.4.1 / libstdc++.6, Qt 5.7.0 in user home installation, efence/duma as distributed by the ubuntu repos (neither efence nor duma have had a new release for ages), QtCreator 4.8.1.

      *Steps to reproduce:*

      • make sure your OS is configured to generate core dumps (`ulimit -c unlimited`, but I took a step further and configured 'limits.d' - /etc/security/limits.conf worked for my case)
      • using QtCreator, create a "Qt widget app" project (my name: QtDummy)
      • Right click on the project and "Add library...". Choose "/usr/bin/duma.so" - or whatever location your OS stores the duma shared lib (the .pro file gets appended with "unix:!macx: LIBS += -lduma")
      • in "Projects/DefaultKit/Run" set a check on "Run on terminal"
      • In "Tools/Options" menu, at "Envirnment/System" settings, set the "/usr/bin/xterm -e" for the "Terminal"
      • build the project. I managed to repro even with a debug build. The make log will be attached
      • run it

      Expected results: see the default window appear.

      Actual result:

      • SIGSEGV and core dump
      • loading the core into gdb and backtracing shows something like:
        Core was generated by `/home/acolomitchi/projects/Qt/QtDummy/build/QtDummy-Desktopglb-Debug/QtDummy'.
        Program terminated with signal SIGSEGV, Segmentation fault.
        #0  0x00007f9cc331d2b3 in QByteArray::append(char) ()
           from /home/acolomitchi/bin/Qt/5.7/gcc_64/lib/libQt5Core.so.5
        (gdb) bt
        #0  0x00007f9cc331d2b3 in QByteArray::append(char) ()
           from /home/acolomitchi/bin/Qt/5.7/gcc_64/lib/libQt5Core.so.5
        #1  0x00007f9cc3b3a7c3 in ?? ()
           from /home/acolomitchi/bin/Qt/5.7/gcc_64/lib/libQt5Widgets.so.5
        #2  0x00007f9cc43f910a in call_init (l=<optimised out>, argc=argc@entry=1, 
            argv=argv@entry=0x7ffc3ff910c8, env=env@entry=0x7ffc3ff910d8)
            at dl-init.c:78
        #3  0x00007f9cc43f91f3 in call_init (env=<optimised out>, 
            argv=<optimised out>, argc=<optimised out>, l=<optimised out>)
            at dl-init.c:36
        #4  _dl_init (main_map=0x7f9cc460d1c8, argc=1, argv=0x7ffc3ff910c8, 
            env=0x7ffc3ff910d8) at dl-init.c:126
        #5  0x00007f9cc43ea30a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
        #6  0x0000000000000001 in ?? ()
        #7  0x00007ffc3ff916d6 in ?? ()
        #8  0x0000000000000000 in ?? ()

      Extra: see https://forum.qt.io/topic/74202/does-efence-play-nice-with-qt-if-not-what-other-tools-for-sigsegvs-in-qt-desktop-apps


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Unassigned Unassigned
            acolomitchi Adrian Colomitchi
            0 Vote for this issue
            4 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes