Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 25 Jul 2017 08:01:16 +0000
From: Jamie Mccrae <>
To: "" <>
Subject: Static Qt console application linked with musl segmentation faults on
 console message output with thread_local variable

I have a simple Qt application which just outputs a single string to the console which I'm compiling on alpine linux (raspberry pi) statically with musl and it causes a segmentation fault when ran. I reported the issue to Qt and provided a stack trace but they say it's a problem with musl and not Qt.

Stack trace:
    (gdb) run
    Starting program: /tmp/TestApp/testconsole
    Program received signal SIGSEGV, Segmentation fault.
    0x74ac7d1c in grabMessageHandler () at global/qlogging.cpp:1618
    1618        if (msgHandlerGrabbed)
    (gdb) bt
   #0  0x74ac7d1c in grabMessageHandler () at global/qlogging.cpp:1618
   #1  0x74ac7e34 in qt_message_print (msgType=QtDebugMsg, context=..., message=...) at global/qlogging.cpp:1649
   #2  0x74ac8024 in qt_message_output (msgType=QtDebugMsg, context=..., message=...) at global/qlogging.cpp:1696
   #3  0x74b85d48 in QDebug::~QDebug (this=0xaefffcdc, __in_chrg=<optimized out>) at io/qdebug.cpp:156
   #4  0x74ac2a04 in main (argc=1, argv=0xaefffd44) at main.cpp:63

Comment from Qt developer:
    Not our bug. That function uses a variable marked with C++11 attribute thread_local. That means it's a MUSL bug.

Musl version: 1.1.16-r13

Sample code to reproduce the issue:

    int main(int argc, char *argv[])
        QCoreApplication app(argc, argv);
        qDebug() << "test output to console";

   #ifndef MAIN_H
    #define MAIN_H
   #include <QCoreApplication>
    #include <QDebug>
    int main(int argc, char *argv[]);
    QT       += core
    QT       -= gui

    TARGET = testconsole
    CONFIG   += console
    CONFIG   -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += \

Expected output:
    test output to console

Actual output:
    Segmentation fault

Build line for Qt which was used on this system:
./configure -confirm-license -opensource -debug -static -no-journald -no-gif -no-ico -no-egl -xinput2 -qt-xkbcommon-x11 -no-compile-examples -no-cups -no-iconv -no-tslib -fontconfig -no-xcb-xlib -no-eglfs -no-directfb -no-linuxfb -no-kms -no-evdev -no-xkbcommon-evdev -no-libproxy -no-mtdev -libinput -dbus-linked -no-glib -icu -no-separate-debug-info -nomake examples -no-opengl -no-openssl -no-sql-sqlite -silent -system-libjpeg -system-libpng -system-pcre -qt-xcb -system-zlib -no-reduce-relocations

Is this a bug in musl, or is any more information required for this?


Content of type "text/html" skipped

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.