[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

Nick Coghlan report at bugs.python.org
Thu Jun 9 13:14:31 EDT 2016


New submission from Nick Coghlan:

This proposal competes directly with #27250, #27266, and #27279 as possible long term solutions to the Linux/systemd os.urandom deadlock bug described in #26839

Rather than adding new APIs, or making os.urandom potentially blocking on Linux (as it was in 3.5.0 and 3.5.1), it instead proposes that os.urandom immediately raise BlockingIOError if the kernel entropy pool has not yet been initialised.

This behaviour will mean that users attempting to gather strong entropy too early in the Linux boot process will fail rather than block, so affected scripts and programs can readily fall back to reading from /dev/urandom or using the random module APIs if they don't need cryptographically strong random data. Scripts that do need cryptographically strong random data can either poll os.urandom until it succeeds, or else fail explicitly and let their caller resolve the problem.

----------
messages: 268041
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Raise BlockingIOError in os.urandom if kernel is not ready
type: enhancement
versions: Python 3.6

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


More information about the Python-bugs-list mailing list