Skip to content

Segmentation fault by opening Preferences tab (Kubuntu 18.10 - 64 bit) #1673

Open

Description

@SilvioGrosso

Hello everyone,

Today, I have noticed a new tweet, https://twitter.com/sqlitebrowser?lang=en, as regards a new AppImage to test on Linux and I did not resist the urge to give it a swirl:

On Kubutu 18.10 (64 bit) - Kde desktop, I always get a segmentation fault while opening the Preferences tab.

It is extremely simple to reproduce this crash:

  • Fire up Db-Browser from the terminal;
  • Edit > Preferences (as soon as you hit the button, Db Browser always crashes).

On Windows 10 (64 bit) everything is fine: No crash whatsoever with the same steps.

Here is a screenshot (I can provide the full backtrace if necessary...):
segmentation_fault

Activity

  1. karim commented on Dec 20, 2018

    @karim
    Member

    The error seems to be related to OpenSSL. Do you have OpenSSL v1.0.2 installed?

  2. SilvioGrosso commented on Dec 20, 2018

    @SilvioGrosso
    Author

    Hello @karim

    Thanks a lot for the swift response!

    Actually, I am a "Windows guy" but I do appreciate Linux as well :-)
    I run Kubuntu 18.10 trough VirtualBox, as guest; the host is Window 10.

    Joking aside, I do have Openssl installed.
    Here is a screenshot with more information:
    openssl

    Here is a full backtrace:
    gdb) run
    Starting program: /home/silvio/Downloads/DB_Browser_for_SQLite-3.10.1-227-587eab4-x86_64.AppImage
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [Detaching after fork from child process 3635]
    process 3606 is executing new program: /tmp/.mount_DB_BroMKjgcr/usr/bin/sqlitebrowser
    warning: Loadable section ".dynstr" outside of ELF segments
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [New Thread 0x7fffeff88700 (LWP 3640)]
    [New Thread 0x7fffeef0b700 (LWP 3641)]
    [New Thread 0x7fffee70a700 (LWP 3642)]
    [New Thread 0x7fffeded3700 (LWP 3643)]
    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
    qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
    qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
    qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
    qt.network.ssl: QSslSocket: cannot resolve sk_new_null
    qt.network.ssl: QSslSocket: cannot resolve sk_push
    qt.network.ssl: QSslSocket: cannot resolve sk_free
    qt.network.ssl: QSslSocket: cannot resolve sk_num
    qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
    qt.network.ssl: QSslSocket: cannot resolve sk_value
    qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
    qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
    qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
    qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
    qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
    qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
    qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
    qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
    qt.network.ssl: QSslSocket: cannot resolve SSLeay
    qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
    qt.network.ssl: Incompatible version of OpenSSL
    [New Thread 0x7fffed014700 (LWP 3644)]
    [Thread 0x7fffed014700 (LWP 3644) exited]

    Thread 1 "AppRun" received signal SIGSEGV, Segmentation fault.
    0x00007ffff6c27189 in QVariant::QVariant(QString const&) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    (gdb) thread apply all bt

    Thread 5 (Thread 0x7fffeded3700 (LWP 3643)):
    #0 0x00007ffff656b6d9 in __GI___poll (fds=0x7fffd801d060, nfds=4, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
    #1 0x00007ffff52d5e46 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #2 0x00007ffff52d5f6c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #3 0x00007ffff6c3c45c in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #4 0x00007ffff6be911b in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #5 0x00007ffff6a1f1ca in QThread::exec() () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #6 0x00007ffff26f5555 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/plugins/platforms/../../lib/libQt5DBus.so.5
    #7 0x00007ffff6a23c5d in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #8 0x00007ffff7f93164 in start_thread (arg=) at pthread_create.c:486
    #9 0x00007ffff6577def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    Thread 4 (Thread 0x7fffee70a700 (LWP 3642)):
    #0 0x00007ffff656b6d9 in __GI___poll (fds=0x7fffe4004a10, nfds=1, timeout=2147483619) at ../sysdeps/unix/sysv/linux/poll.c:29
    #1 0x00007ffff52d5e46 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #2 0x00007ffff52d5f6c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #3 0x00007ffff6c3c45c in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #4 0x00007ffff6be911b in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #5 0x00007ffff6a1f1ca in QThread::exec() () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #6 0x00007ffff6a23c5d in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #7 0x00007ffff7f93164 in start_thread (arg=) at pthread_create.c:486
    #8 0x00007ffff6577def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    Thread 3 (Thread 0x7fffeef0b700 (LWP 3641)):
    #0 futex_wait_cancelable (private=, expected=0, futex_word=0xc53ad8) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
    #1 __pthread_cond_wait_common (abstime=0x0, mutex=0xc53a88, cond=0xc53ab0) at pthread_cond_wait.c:502
    #2 __pthread_cond_wait (cond=0xc53ab0, mutex=0xc53a88) at pthread_cond_wait.c:655
    #3 0x00007ffff68a583c in std::condition_variable::wait(std::unique_lockstd::mutex&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4 0x00000000005a07cb in RowLoader::run() ()
    #5 0x00007ffff6a23c5d in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #6 0x00007ffff7f93164 in start_thread (arg=) at pthread_create.c:486
    #7 0x00007ffff6577def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    Thread 2 (Thread 0x7fffeff88700 (LWP 3640)):
    --Type for more, q to quit, c to continue without paging--
    #0 0x00007ffff656b6d9 in __GI___poll (fds=0x7fffeff87d28, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
    #1 0x00007ffff375b917 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
    #2 0x00007ffff375d53a in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
    #3 0x00007ffff2abfb09 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5
    #4 0x00007ffff6a23c5d in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #5 0x00007ffff7f93164 in start_thread (arg=) at pthread_create.c:486
    #6 0x00007ffff6577def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    Thread 1 (Thread 0x7ffff31202c0 (LWP 3606)):
    #0 0x00007ffff6c27189 in QVariant::QVariant(QString const&) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #1 0x00007ffff783b7dc in QTableWidgetItem::QTableWidgetItem(QString const&, int) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #2 0x000000000057696e in PreferencesDialog::loadSettings() ()
    #3 0x0000000000578107 in PreferencesDialog::PreferencesDialog(QWidget*) ()
    #4 0x000000000054ad17 in MainWindow::openPreferences() ()
    #5 0x0000000000659175 in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
    #6 0x00007ffff6c145ef in QMetaObject::activate(QObject*, int, int, void**) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #7 0x00007ffff75a6922 in QAction::triggered(bool) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #8 0x00007ffff75a908d in QAction::activate(QAction::ActionEvent) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #9 0x00007ffff7718fe2 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #10 0x00007ffff771f9e4 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #11 0x00007ffff77208fb in QMenu::mouseReleaseEvent(QMouseEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #12 0x00007ffff75e86b7 in QWidget::event(QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #13 0x00007ffff7722c4b in QMenu::event(QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #14 0x00007ffff75ac8fc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #15 0x00007ffff75b4099 in QApplication::notify(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #16 0x00007ffff6beafb5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #17 0x00007ffff75b2ef9 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer&, bool) ()
    from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #18 0x00007ffff7600b3c in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #19 0x00007ffff7603363 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #20 0x00007ffff75ac8fc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #21 0x00007ffff75b39e0 in QApplication::notify(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Widgets.so.5
    #22 0x00007ffff6beafb5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #23 0x00007ffff6fe646d in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
    from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Gui.so.5
    --Type for more, q to quit, c to continue without paging--
    #24 0x00007ffff6fe8025 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
    from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Gui.so.5
    #25 0x00007ffff6fc64eb in QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag) ()
    from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Gui.so.5
    #26 0x00007ffff2b28e50 in ?? () from /tmp/.mount_DB_BroMKjgcr/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5
    #27 0x00007ffff52d5c3e in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #28 0x00007ffff52d5ed8 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #29 0x00007ffff52d5f6c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    #30 0x00007ffff6c3c45c in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #31 0x00007ffff6be911b in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #32 0x00007ffff6bf18a4 in QCoreApplication::exec() () from /tmp/.mount_DB_BroMKjgcr/usr/bin/../lib/libQt5Core.so.5
    #33 0x00000000004f14bb in main ()
    (gdb)

  3. karim commented on Dec 20, 2018

    @karim
    Member

    Actually, I am a "Windows guy" but I do appreciate Linux as well :-)

    Same. 😃

    I do have Openssl installed

    I think you need 1.0.2. Check this comment #1592 (comment) (and maybe some of the comments above and below it) for more info.

    The first screenshot gave a hint about this error (Incompatible version of OpenSSL).

  4. justinclift commented on Dec 20, 2018

    @justinclift
    Member

    Ahhh yeah, that does look like a mismatch in OpenSSL versions. I thought the AppImage thing was supposed to bundle it's needed pieces all together in order to avoid this.

    Let's ping @deepsidhu1313 and @probonopd, as they've been working on AppImage stuff in #1092. 😄

  5. justinclift commented on Dec 20, 2018

    @justinclift
    Member

    Possibly we will need to bundle OpenSSL libraries inside the AppImage and not use the ones that come with the system.

    Yep. From the first part of the GitLab reference above:

    Currently applications cannot rely on these:

    libssl.so.1
    libssl.so.1.0.0
    libcrypto.so.1
    libcrypto.so.1.0.0

    They should be standardized across all distributions.

    It's even more complicated. 😉 As an example, for several years the Red Hat Linux's (Fedora, RHEL, CentOS, ...) provided modified versions of OpenSSL. eg without ECC in order to avoid patent problems.

    From memory, there were also FIPS builds for compliance with specific market requirements too.

    For situations like OpenSSL... bundling a "known working" version seems like the most practical approach.

  6. probonopd commented on Dec 21, 2018

    @probonopd
    Contributor

    If we bundle OpenSSL, then we either must also ship the certificates or (preferred) patch OpenSSL so that it loads certificates from all the different places distributions happen to put them (for no apparent good reason other than "distribution policy"):

    "/etc/ssl/certs/ca-certificates.crt",     // Debian/Ubuntu/Gentoo etc.
    "/etc/pki/tls/certs/ca-bundle.crt",       // Fedora/RHEL
    "/etc/ssl/ca-bundle.pem",                 // OpenSUSE
    "/etc/pki/tls/cacert.pem",                // OpenELEC
    "/etc/ssl/certs",                         // SLES10/SLES11, https://golang.org/issue/12139
    "/usr/share/ca-certs/.prebuilt-store/"    // Clear Linux OS; https://github.com/knapsu/plex-media-player-appimage/issues/17#issuecomment-437710032
    "/system/etc/security/cacerts"            // Android
    

    I am wondering whether we could use LD_PRELOAD to add the missing certificate paths, without having to recompile OpenSSL.

  7. justinclift commented on Dec 21, 2018

    @justinclift
    Member

    With shipping certificates, the technical piece might be easy (not sure). Suspecting the harder part would be figuring out which certificates to ship.

    Is there a canonical source that could reasonably be used? eg does upstream OpenSSL have them in a repo somewhere, or maybe use the Mozilla/Arch/some-other-OSS-place ones?

  8. probonopd commented on Dec 21, 2018

    @probonopd
    Contributor

    Also you want certificate updates be handled by the distribution...

  9. justinclift commented on Dec 21, 2018

    @justinclift
    Member

    Sure, but "want" is just that. It's the preferable option, but isn't a hard technical requirement to achieving the result.

    When shipping certificates, at least initially anyway, it's probably not going to be feasible. How about trying some approach with shipping certificates to start with (behind an experimental flag maybe?), and see how it goes in practise? 😄

  10. probonopd commented on Dec 21, 2018

    @probonopd
    Contributor

    When shipping certificates, at least initially anyway, it's probably not going to be feasible.

    Why not? By building OpenSSL with a patch (similar to the gnutls one) that makes it search for certificates in all known locations it should be more than doable.

  11. justinclift commented on Dec 22, 2018

    @justinclift
    Member

    Hmmm. Was just thinking that if you're providing a self contained application for people, whose purpose is to "work everywhere", then relying on external things like the distro provided certs doesn't really fit. eg different certs provided by different distro's could change the behaviour across distro's. eg cert X being accepted on (say) Devuan, but not on (say) RHEL

    That was just an initial thought though. Thinking about it more... meh... it's not my area of expertise, nor something I particularly care about, so I'll butt out. 😄

  12. probonopd commented on Dec 22, 2018

    @probonopd
    Contributor

    AppImageCommunity/pkg2appimage@6c7473d#commitcomment-21574732 confirms that bundling libcrypto.so.1.0.0 can cause issues due to certificates being all over the place in the different distributions:

    # On Ubuntu Trusty:
    > strings /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 | grep 'SSLDIR\|\.pem'
    OPENSSLDIR: "/usr/lib/ssl"
    /usr/lib/ssl/cert.pem
    # On Arch Linux:
    strings /lib64/libcrypto.so.1.0.0 | grep 'SSLDIR\|\.pem'
    OPENSSLDIR: "/etc/ssl"
    /etc/ssl/cert.pem
  13. probonopd commented on Dec 22, 2018

    @probonopd
    Contributor

    Quick experimentation shows:

    # libcrypto has hardcoded OPENSSLDIR
    strings /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 | grep OPENSSLDIR
    OPENSSLDIR: "/usr/lib/ssl"
    
    # Simulate OPENSSLDIR being somewhere else
    sudo mv  /usr/lib/ssl  /usr/lib/sss
    
    wget -c "https://github.com" -O -
    # FAILS
    
    export OPENSSLDIR=/usr/lib/sss/ 
    wget -c "https://github.com" -O -
    # FAILS TOO
    
    # Revert experiment
    sudo mv /usr/lib/sss /usr/lib/ssh
    
    # There is also ENGINESDIR...
    me@host:~$ openssl version -a
    OpenSSL 1.1.0g  2 Nov 2017
    built on: reproducible build, date unspecified
    platform: debian-amd64
    compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/lib/ssl\"" -DENGINESDIR="\"/usr/lib/x86_64-linux-gnu/engines-1.1\"" 
    OPENSSLDIR: "/usr/lib/ssl"
    ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-1.1"
    

    So apparently this was compiled with -DOPENSSLDIR="\"/usr/lib/ssl\"" -="\"/usr/lib/x86_64-linux-gnu/engines-1.1\"".

    So, how can we override OPENSSLDIR and DENGINESDIR at runtime, short of recompiling libcrypto?

    According to https://mta.opeanssl.org/pipermail/openssl-users/2016-November/004855.html, iOS apps may be running into the same issue (and may have resolved it).

  14. added a commit that references this issue on Dec 22, 2018
  15. deepsidhu1313 commented on Dec 22, 2018

    @deepsidhu1313
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions