[Development] QRandomGenerator and boot times

Henry Skoglund fromqt at tungware.se
Thu Sep 14 18:00:45 CEST 2017


On 2017-09-14 09:21, Sami Nurmenniemi wrote:
> 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
> - It seems code using this in qhash.cpp is the actual reason for the 
> blocked processes (originated from QDebug)
> 4. Something else?

Hi, couldn't you just look at system's uptime (using sysinfo() for 
example), use /dev/urandom if the uptime is less than say 10 minutes, 
and use getentropy for the rest of the day?

Rgrds Henry




More information about the Development mailing list