Marc-Andre Lemburg added the comment:

On 09.06.2016 09:57, STINNER Victor wrote:
> 
> STINNER Victor added the comment:
> 
> I played with select() on Linux on a VM:
> 
> * /dev/random: it works as expected
> * /dev/urandom: the device is already seen as readable even before the 
> urandom entropy pool is initialized. It is not really surprising since, yes, 
> read() does not block in practice
> 
> To test Python before urandom is initialized, I used the init=/path/to/python 
> trick in the boot loader.

It's best to look at the code for this in Linux:

http://lxr.free-electrons.com/source/drivers/char/random.c

getrandom() is implemented directly on top of the two
devices:

http://lxr.free-electrons.com/source/drivers/char/random.c#L1601

> By the way, I confirm that getrandom(GRND_NONBLOCK) fails with EAGAIN before 
> urandom is initialized.

Right, and that's good, since it's better to let the application
control what to do than to simply block.

Here's a good reading on getrandom():

https://lwn.net/Articles/606141/

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to