[onerng talk] Blinking LED

James Cameron quozl at laptop.org
Thu Jun 18 00:58:19 BST 2015


On Wed, 17 Jun 2015 16:45:33 Robin Sheat wrote:
> It'll go off for a 2-3 seconds, then come on for an irregular amount
> of time that might be 2 seconds or might be 8 seconds.

Similar seen here, but with different on times.  Samples of on times
on my device: 40 10 50 10 29 40.

This is the pattern I see when rngd is not running, or if rngd is
running but there is very little demand for random numbers; and strace
of rngd shows it is not reading the device often.

I looked for a relationship between the blink pattern and rngd, but
didn't find any.

My strace shows rngd waits on the /dev/random file descriptor until
POLLOUT occurs, then it makes an RNDADDENTROPY ioctl call.

Every now and then rngd completes a read of the /dev/ttyACM0 file
descriptor, of 2500 bytes.

If there is demand for random numbers, rngd refills a buffer faster,
which increases frequency of reads on /dev/ttyACM0.  The pattern of
blinks seems to be hidden with sufficient demand.

I measured the demand for random numbers; the number of reads made by
rngd in a minute;

#!/bin/bash
PID=$(pgrep rngd)
strace -o rngd.strace -p $PID -e read &
sleep 60 && kill -INT $!
wc --lines rngd.strace

For my system, at time of writing, there's about one read per minute,
and I can increase that to 23790 by using

	dd if=/dev/random of=/dev/null

The /dev/ttyACM0 reads under load are a lot smaller; like 128 bytes.

The first time I ran this test, the partially lit LED stopped and
syslog showed me this:

Jun 18 09:40:53 esk rngd: too many FIPS failures, disabling entropy source
Jun 18 09:40:53 esk rngd: No entropy sources working, exiting rngd

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Discuss mailing list