[Development] QRandomGenerator and boot times
Sami Nurmenniemi
sami.nurmenniemi at qt.io
Tue Sep 19 12:45:48 CEST 2017
On 19.09.2017 13:16, Konstantin Tokarev wrote:
>
> 19.09.2017, 13:14, "Konstantin Tokarev" <annulen at yandex.ru>:
>> 14.09.2017, 10:22, "Sami Nurmenniemi" <sami.nurmenniemi at qt.io>:
>>> Hi,
>>>
>>> Commit 120ecc976fc3d5504d234702f68c2ad3898b77a4 changes default behavior of QRandomGenerator to use getentropy instead of /dev/urandom. This causes problems for device boot times when using QRandomGenerator in the boot sequence. As the commit message itself states "What's more, the glibc implementation blocks until entropy is available on early boot". Depending on the hw + kernel configuration of the device, this can increase boot time by more than a minute. For example in the Boot2Qt image qdbd and qtlauncher demo now block until the nonblocking pool is initialized. See QTBUG-63188.
>>>
>>> What do you suggest for working around this problem?
>>> 1. Disable feature "getentropy" from Boot2Qt builds
>>> - This is the behavior in Qt < 5.10.x
>>> - Only difference in the entropy of randomness is in the early boot
>>> 2. Add "rng-tools" to the image for inputting entropy to the kernel
>>> - Speeds up initialization of nonblocking pool
>>> - On devices with HW random generator, this adds real entropy to the kernel pool
>>> - On devices without HW random generator, this adds bad entropy from /dev/urandom to the kernel pool
>>> 3. Setting QT_HASH_SEED for the affected processes
>>> - Not a good solution IMO
>> Why? Is hash randomization really important in your case?
> Actually, you can read value of QT_HASH_SEED from /dev/urandom, restoring previous behavior exactly.
Thanks, that's one more option for the fastboot demo. We already enabled
rng-tools + hwrng for the normal Boot2Qt images and boot time is no more
problem for those.
>> Also, you may want to replace QHash with a different data structure in your boot code.
>>
>>> - It seems code using this in qhash.cpp is the actual reason for the blocked processes (originated from QDebug)
>>> 4. Something else?
>>>
>>> Best Regards,
>>> Sami Nurmenniemi
>>>
>>> ,
>>>
>>> _______________________________________________
>>> Development mailing list
>>> Development at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/development
>> --
>> Regards,
>> Konstantin
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
More information about the Development
mailing list