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

QHash freezes due to call to getrandom() via glibc 's getentropy()

    XMLWordPrintable

Details

    • 928ce402a41c291e6f746cac903a4a44702c4689 (qt/tqtc-qtbase/dev)

    Description

      Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898092#34 Note: linked to the specific mail that explain the issue.

      We have been observing SDDM to "halt" for seconds until someone interacts with the machine. The bug has been reported also to the kernel, so Ben Hutchings, Debian's linux kernel maintainer, found this:

      sddm is making a blocking call to getrandom(), via the glibc function
      getentropy(), via the QRandomGenerator class. Here's a backtrace:
      
      #0  0x00007ffff5ef303a in getentropy (buffer=0x7fffffffe9dc, 
          length=<optimized out>) at ../sysdeps/unix/sysv/linux/getentropy.c:45
      #1  0x00007ffff68a2beb in ?? ()
         from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #2  0x00007ffff68a3538 in QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int) ()
         from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #3  0x00007ffff69af7c1 in ?? ()
         from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #4  0x00007ffff69aef3b in QLoggingCategory::defaultCategory() ()
         from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #5  0x00007ffff683d815 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) () from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #6  0x00007ffff693bf70 in QDebug::~QDebug() ()
         from target:/usr/lib/x86_64-linux-gnu/libQt5Core.so.5
      #7  0x000055555559c870 in SDDM::DaemonApp::DaemonApp(int&, char**) ()
      #8  0x000055555557d1c6 in main ()
      
      Reassigning this to Qt as it is not safe to use these functions in a
      general-purpose library for Linux.  They should only be used if it's
      acceptable to wait some time for entropy to be available.

       

      Reading https://doc.qt.io/qt-5.11/qrandomgenerator.html#system-wide-random-number-generator it makes me think this should not be happening, but clearly QHash is stalling things here.

      You can also take a look at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898021 in order to see the same bug from a kernel point of view.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            lisandropm Lisandro Damián Nicanor Pérez Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes