[issue25420] "import random" blocks on entropy collection on Linux with low entropy
STINNER Victor
report at bugs.python.org
Tue Oct 20 03:47:25 EDT 2015
STINNER Victor added the comment:
Hi,
Марк Коренберг added the comment:
> Man getrandom()
>
> As of Linux 3.19, the following bug exists:
>
> * Depending on CPU load, getrandom() does not react to interrupts
> before reading all bytes requested.
>
> So, is it goot to use this syscall now?
I saw a fix proposed on the LKML but it looks like it was not merged.
I don't know what to think about this bug.
getrandom(n, GRND_NONBLOCK) behaviour depends if /dev/urandom was
feeded with enough entropy and the value of n. It should not be
interrupted by signal for n <= 256.
Can you reproduce the bug? Which kind of applications can hang because
of this bug?
I would prefer to continue to use getrandom() syscall on Linux, avoid
using a file descriptor is really useful.
Maybe we can try to document the behaviour of os.urandom() for signal
handling? Or at least redirect users to getrandom() manual page.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25420>
_______________________________________
More information about the Python-bugs-list
mailing list