diff options
author | Andreas Oberritter <obi@opendreambox.org> | 2017-02-08 00:48:54 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-15 20:06:28 -0800 |
commit | 3f2be1c857a44030478ce25b4a722667b73de446 (patch) | |
tree | b1d088fecb2df39daeabcbe5647ddc8c262e8a6b /meta/recipes-devtools | |
parent | 6437f14c9177fd7ec7a9b6bca873362b0c94abfb (diff) | |
download | openembedded-core-3f2be1c857a44030478ce25b4a722667b73de446.tar.gz openembedded-core-3f2be1c857a44030478ce25b4a722667b73de446.tar.bz2 openembedded-core-3f2be1c857a44030478ce25b4a722667b73de446.zip |
python: Don't use getentropy on Linux
Backport a patch from 2.7 branch to fix a regression with glibc
2.24 causing "OSError: [Errno 38] Function not implemented" when
calling urandom() with older kernels.
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/python/python/Don-t-use-getentropy-on-Linux.patch | 41 | ||||
-rw-r--r-- | meta/recipes-devtools/python/python_2.7.12.bb | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/Don-t-use-getentropy-on-Linux.patch b/meta/recipes-devtools/python/python/Don-t-use-getentropy-on-Linux.patch new file mode 100644 index 0000000000..38e53778dc --- /dev/null +++ b/meta/recipes-devtools/python/python/Don-t-use-getentropy-on-Linux.patch @@ -0,0 +1,41 @@ +Upstream-Status: Backport + +Signed-off-by: Andreas Oberritter <obi@opendreambox.org> + +From 905d1b30ac7cb0e31c57cec0533825c8f170b942 Mon Sep 17 00:00:00 2001 +From: Victor Stinner <victor.stinner@gmail.com> +Date: Mon, 9 Jan 2017 11:10:41 +0100 +Subject: [PATCH] Don't use getentropy() on Linux + +Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but +read from /dev/urandom to get random bytes, for example in os.urandom(). On +Linux, getentropy() is implemented which getrandom() is blocking mode, whereas +os.urandom() should not block. + +(cherry picked from commit 2687486756721e39164fa9f597e468c35d495227) +--- + Python/random.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/Python/random.c b/Python/random.c +index b4bc1f3..f3f5d14 100644 +--- a/Python/random.c ++++ b/Python/random.c +@@ -94,8 +94,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(). diff --git a/meta/recipes-devtools/python/python_2.7.12.bb b/meta/recipes-devtools/python/python_2.7.12.bb index 9fe35db2de..2c6a3194a2 100644 --- a/meta/recipes-devtools/python/python_2.7.12.bb +++ b/meta/recipes-devtools/python/python_2.7.12.bb @@ -27,6 +27,7 @@ SRC_URI += "\ file://use_sysroot_ncurses_instead_of_host.patch \ file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \ file://python-fix-CVE-2016-1000110.patch \ + file://Don-t-use-getentropy-on-Linux.patch \ " S = "${WORKDIR}/Python-${PV}" |