]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/python-2.7.13-getentropy.patch
gcc: Fix building with glibc >= 2.28
[people/pmueller/ipfire-2.x.git] / src / patches / python-2.7.13-getentropy.patch
1 diff --git a/Python/random.c b/Python/random.c
2 index 2f83b5d..4cae217 100644
3 --- a/Python/random.c
4 +++ b/Python/random.c
5 @@ -97,8 +97,15 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
6 }
7
8 /* Issue #25003: Don't use getentropy() on Solaris (available since
9 - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */
10 -#elif defined(HAVE_GETENTROPY) && !defined(sun)
11 + Solaris 11.3), it is blocking whereas os.urandom() should not block.
12 +
13 + Issue #29188: Don't use getentropy() on Linux since the glibc 2.24
14 + implements it with the getrandom() syscall which can fail with ENOSYS,
15 + and this error is not supported in py_getentropy() and getrandom() is called
16 + with flags=0 which blocks until system urandom is initialized, which is not
17 + the desired behaviour to seed the Python hash secret nor for os.urandom():
18 + see the PEP 524 which was only implemented in Python 3.6. */
19 +#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux)
20 #define PY_GETENTROPY 1
21
22 /* Fill buffer with size pseudo-random bytes generated by getentropy().