1 |
commit: a67db7a3cb4295fa103b5d2879931f560f0a81bd |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 1 16:02:54 2017 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 1 16:03:13 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a67db7a3 |
7 |
|
8 |
dev-lang/python: 3.4: disable getentropy() on linux |
9 |
|
10 |
Closes: https://bugs.gentoo.org/635534 |
11 |
Package-Manager: Portage-2.3.13, Repoman-2.3.3_p80 |
12 |
|
13 |
dev-lang/python/files/3.4-getentropy-linux.patch | 40 ++++++++++++++++++++++++ |
14 |
dev-lang/python/python-3.4.5.ebuild | 1 + |
15 |
dev-lang/python/python-3.4.6.ebuild | 1 + |
16 |
3 files changed, 42 insertions(+) |
17 |
|
18 |
diff --git a/dev-lang/python/files/3.4-getentropy-linux.patch b/dev-lang/python/files/3.4-getentropy-linux.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..9f12389bb25 |
21 |
--- /dev/null |
22 |
+++ b/dev-lang/python/files/3.4-getentropy-linux.patch |
23 |
@@ -0,0 +1,40 @@ |
24 |
+From 5635d44079e1bbd9c495951ede8d078e7b8d67d5 Mon Sep 17 00:00:00 2001 |
25 |
+From: Victor Stinner <victor.stinner@×××××.com> |
26 |
+Date: Mon, 9 Jan 2017 11:10:41 +0100 |
27 |
+Subject: [PATCH] Don't use getentropy() on Linux |
28 |
+ |
29 |
+Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but |
30 |
+read from /dev/urandom to get random bytes, for example in os.urandom(). On |
31 |
+Linux, getentropy() is implemented which getrandom() is blocking mode, whereas |
32 |
+os.urandom() should not block. |
33 |
+--- |
34 |
+ Python/random.c | 13 ++++++++++--- |
35 |
+ 1 file changed, 10 insertions(+), 3 deletions(-) |
36 |
+ |
37 |
+diff --git a/Python/random.c b/Python/random.c |
38 |
+index af3d0bd0d5..dc6400d3b8 100644 |
39 |
+--- a/Python/random.c |
40 |
++++ b/Python/random.c |
41 |
+@@ -67,9 +67,16 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) |
42 |
+ return 0; |
43 |
+ } |
44 |
+ |
45 |
+-/* Issue #25003: Don' use getentropy() on Solaris (available since |
46 |
+- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ |
47 |
+-#elif defined(HAVE_GETENTROPY) && !defined(sun) |
48 |
++/* Issue #25003: Don't use getentropy() on Solaris (available since |
49 |
++ Solaris 11.3), it is blocking whereas os.urandom() should not block. |
50 |
++ |
51 |
++ Issue #29188: Don't use getentropy() on Linux since the glibc 2.24 |
52 |
++ implements it with the getrandom() syscall which can fail with ENOSYS, |
53 |
++ and this error is not supported in py_getentropy() and getrandom() is called |
54 |
++ with flags=0 which blocks until system urandom is initialized, which is not |
55 |
++ the desired behaviour to seed the Python hash secret nor for os.urandom(): |
56 |
++ see the PEP 524 which was only implemented in Python 3.6. */ |
57 |
++#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux) |
58 |
+ #define PY_GETENTROPY 1 |
59 |
+ |
60 |
+ /* Fill buffer with size pseudo-random bytes generated by getentropy(). |
61 |
+-- |
62 |
+2.15.0.rc2 |
63 |
+ |
64 |
|
65 |
diff --git a/dev-lang/python/python-3.4.5.ebuild b/dev-lang/python/python-3.4.5.ebuild |
66 |
index 20fadf8ea6f..29991dd53ae 100644 |
67 |
--- a/dev-lang/python/python-3.4.5.ebuild |
68 |
+++ b/dev-lang/python/python-3.4.5.ebuild |
69 |
@@ -72,6 +72,7 @@ src_prepare() { |
70 |
EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
71 |
epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
72 |
epatch "${FILESDIR}/${PN}-3.4.5-cross.patch" |
73 |
+ epatch "${FILESDIR}/3.4-getentropy-linux.patch" |
74 |
|
75 |
epatch_user |
76 |
|
77 |
|
78 |
diff --git a/dev-lang/python/python-3.4.6.ebuild b/dev-lang/python/python-3.4.6.ebuild |
79 |
index 80dffce2af5..4e06debaade 100644 |
80 |
--- a/dev-lang/python/python-3.4.6.ebuild |
81 |
+++ b/dev-lang/python/python-3.4.6.ebuild |
82 |
@@ -72,6 +72,7 @@ src_prepare() { |
83 |
EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
84 |
epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
85 |
epatch "${FILESDIR}/${PN}-3.4.5-cross.patch" |
86 |
+ epatch "${FILESDIR}/3.4-getentropy-linux.patch" |
87 |
|
88 |
epatch_user |