[New-bugs-announce] [issue29188] Backport random.c from Python 3.5 to Python 2.7

STINNER Victor report at bugs.python.org
Fri Jan 6 18:53:54 EST 2017


New submission from STINNER Victor:

Python 3.6 uses the new getrandom() function/syscall on Linux and Solaris to get random bytes with no file descriptor: it prevents EMFILE and ENFILE errors or surprises when opening a first file (and looking at its file descriptor).

I propose to copy and adapt Python/random.c from Python 3.5 when Python 3.5 will be updated for the issue #29157. Python 2.7 requires extra changes:

* configure.ac: need to check linux/random.h in AC_CHECK_HEADERS()
* random.c: need to keep vms_urandom() function (Python 2.7 still supports VMS!)
* Python 2.7 doesn't implement the PEP 475 (EINTR) and so don't have functions like _Py_read() which handles EINTR for us.

See also the issue #29157 for the latest change in random.c: prefer getrandom() over getentropy() to support the glibc 2.24.

----------
messages: 284876
nosy: haypo
priority: normal
severity: normal
status: open
title: Backport random.c from Python 3.5 to Python 2.7
type: security
versions: Python 2.7

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


More information about the New-bugs-announce mailing list