[issue26839] Python 3.5 running on Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

Donald Stufft report at bugs.python.org
Tue Jun 7 09:43:55 EDT 2016


Donald Stufft added the comment:

> The net effect is that *all* invocations of Python will block at startup if the system RNG is blocking. The only reason this is being called out as Linux-specific is that the behavior has been noticed in Linux.

The fix is Linux specific, because all other modern OSs don't allow you to read randomness from /dev/urandom until the bool is initialized. So the problem that this ticket has exists on all platforms *by design* because every modern platform but Linux has a good implementation of /dev/urandom with regards to the behavior prior to the pool being fully initialized. IOW this patch on OpenBSD (where this syscall also exists) will cause us to try getrandom(), fail because it would have to block, then open up /dev/urandom and then.. block again because OpenBSD made reasonable choices and doesn't allow people to read bad random off it's random device.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26839>
_______________________________________


More information about the Python-bugs-list mailing list