Subject: Re: Bug#898092: sddm: takes extremely long time to start

From: Ben Hutchings <[email-masked]>
Date: Fri, 20 Jul 2018 11:53:03 +0100

Control: reassign -1 src:qtbase-opensource-src 5.10.1+dfsg-7
Control: reassign 898021 src:qtbase-opensource-src 5.10.1+dfsg-7
Control: unblock -1 with 898021
Control: forcemerge -1 898021

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.

Ben.

-- 
Ben Hutchings
No political challenge can be met by shopping. - George Monbiot

---

From: Lisandro Damián Nicanor Pérez Meyer <[email-masked]>
Date: Fri, 20 Jul 2018 10:19:25 -0300

Control: forwarded -1 https://bugreports.qt.io/browse/QTBUG-69555

Hi Ben!

El viernes, 20 de julio de 2018 07:53:03 -03 Ben Hutchings escribió:
> #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
> #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() ()

Thanks *a lot* for the analysis. I have checked the SDDM and Qt code and 
indeed it seems a bug in Qt, as QRandomGenerator is used in QHash. However it 
might be a bug because according to the doc it should detect this cases and 
fall back to pseudo-random generators.

All in all, thanks again for pointing this.

-- 
Los estadounidenses no tienen la culpa, la guerra tiene la culpa. La falta de
voluntad de la gente para comprender a aquellos que tienen valores diferentes,
eso es lo que tiene la culpa.
  Shinji Mikamo
  <http://www.lanacion.com.ar/1716475-el-cataclismo-nuclear-de-hiroshima-narrado-por-un-superviviente>

Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/