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

Qt's usage of RTLD_NODELETE when available can cause segfaults or more obscure problems on Android versions not supporting it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.10.0, 5.10.1
    • Fix Version/s: None
    • Component/s: QPA
    • Labels:
      None
    • Environment:
      openSUSE Leap v42.3

      android ndk v16b

      android sdk v26

      clang

      armeabi-v7a

      devices running Android v5.1
    • Platform/s:
      Android

      Description

      Upgrading to ndk v16b and qt v5.10.0 exposed that QTBUG-63892 and QTBUG-63894 in fact are related and caused by the same underlying issue. (so this qtbug could be regarded as a replacement for the two others, though I did not close those two yet because of the additional info they contain).

      As it turns out, the fact that RTLD_NODELETE is defined in the ndk sysroot (dlfcn.h), which causes it to be picked up by qtbase/src/corelib/plugin/qlibrary_unix.cpp, is responsible for both issues described in the other bugreports:

      • when a 'regular' library marked with RTLD_NODELETE is loaded runtime using dlopen() on a device running Android v5.1 not supporting this flag, then the library load fails with an error about the unsupported flag
      • the segfault on engine.load() is caused by the same mechanism, I suspect due to the failed loading of a critical plugin library due to the same problem; the segfault may be a bit harsh here, even when there's no way to get around the missing plugin

      Bluntly removing the RTLD_NODELETE define from the ndk sysroot dlfcn.h file makes both issues disappear, but this hardly seems to be the preferred way.

      Qt's current code uses the RTLD_NODELETE flag when it's defined, regardless of whether the target device is supporting it. This was fine when the ndk's had specific headers for specific api levels, but now that they have switched to unified headers, this flag will be active for all devices / api levels, even when they will fail runtime because it's not supported.

       

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                esabraha Eskil Abrahamsen Blomfeldt
                Reporter:
                mr.gadgets Frank van Vugt
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes