]> git.baikalelectronics.ru Git - kernel.git/commit
random: only read from /dev/random after its pool has received 128 bits
authorTheodore Ts'o <tytso@mit.edu>
Wed, 20 Feb 2019 21:06:38 +0000 (16:06 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 17 Apr 2019 14:30:21 +0000 (10:30 -0400)
commit6b6cc7ad59005e2de8cc28ad19fcc62e1688e2d0
tree1468f49bdedaa14160e4d8236926f2447381988b
parent8da267f8fcb8842886dcfb2b2d705b5e9f27ec5e
random: only read from /dev/random after its pool has received 128 bits

Immediately after boot, we allow reads from /dev/random before its
entropy pool has been fully initialized.  Fix this so that we don't
allow this until the blocking pool has received 128 bits.

We do this by repurposing the initialized flag in the entropy pool
struct, and use the initialized flag in the blocking pool to indicate
whether it is safe to pull from the blocking pool.

To do this, we needed to rework when we decide to push entropy from the
input pool to the blocking pool, since the initialized flag for the
input pool was used for this purpose.  To simplify things, we no
longer use the initialized flag for that purpose, nor do we use the
entropy_total field any more.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
drivers/char/random.c
include/trace/events/random.h