Don't blow up on EL7 kernel (random generator) (rhbz#1410175, rhbz#1410187)

This commit is contained in:
Charalampos Stratakis 2017-01-11 20:39:50 +01:00
parent 202761631b
commit aabe04e255
2 changed files with 31 additions and 5 deletions

22
00250-getentropy.patch Normal file
View File

@ -0,0 +1,22 @@
diff --git a/Python/random.c b/Python/random.c
index 2f83b5d..4cae217 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -97,8 +97,15 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
}
/* Issue #25003: Don't use getentropy() on Solaris (available since
- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */
-#elif defined(HAVE_GETENTROPY) && !defined(sun)
+ Solaris 11.3), it is blocking whereas os.urandom() should not block.
+
+ Issue #29188: Don't use getentropy() on Linux since the glibc 2.24
+ implements it with the getrandom() syscall which can fail with ENOSYS,
+ and this error is not supported in py_getentropy() and getrandom() is called
+ with flags=0 which blocks until system urandom is initialized, which is not
+ the desired behaviour to seed the Python hash secret nor for os.urandom():
+ see the PEP 524 which was only implemented in Python 3.6. */
+#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux)
#define PY_GETENTROPY 1
/* Fill buffer with size pseudo-random bytes generated by getentropy().

View File

@ -735,11 +735,12 @@ Patch193: 00193-enable-loading-sqlite-extensions.patch
# 00198 #
Patch198: 00198-add-rewheel-module.patch
# 00200 #
# test_gdb.test_threads fails when run within rpmbuild
# I couldnt reproduce the issue outside of rpmbuild, therefore
# I skip test for now
Patch200: 00200-skip-thread-test.patch
# 00250 #
# After glibc-2.24.90, Python failed to start on EL7 kernel
# rhbz#1410175: https://bugzilla.redhat.com/show_bug.cgi?id=1410175
# http://bugs.python.org/issue29157
# Fixed upstream: https://hg.python.org/cpython/rev/13a39142c047
Patch250: 00250-getentropy.patch
# (New patches go here ^^^)
#
@ -1056,6 +1057,8 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c
%patch198 -p1
%endif
%patch250 -p1
# This shouldn't be necesarry, but is right now (2.2a3)
find -name "*~" |xargs rm -f
@ -1920,6 +1923,7 @@ rm -fr %{buildroot}
%changelog
* Wed Jan 11 2017 Charalampos Stratakis <cstratak@redhat.com> - 2.7.13-1
- Update to 2.7.13
- Don't blow up on EL7 kernel (random generator) (rhbz#1410175, rhbz#1410187)
* Thu Oct 27 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.7.12-9
- Rename package to python2 and also rename the subpackages accordingly