1 |
commit: 7565f43fc1c544625d153f510b950f9f9bf6e848 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 1 15:22:38 2016 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 1 15:23:11 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7565f43f |
7 |
|
8 |
dev-libs/jemalloc: Patch added to fix an issue with sys-apps/sandbox |
9 |
|
10 |
Cherry picked commit c443b67561 [Link 1] which fixes an issue which |
11 |
prevented any jemalloc-enabled application from running through |
12 |
sys-apps/sandbox (typical use case is emerge with FEATURES=sandbox and |
13 |
FEATURES=test). |
14 |
|
15 |
Cherry picked commit 3c8c3e9e9b [Link 2] which fixes a leaked file |
16 |
descriptor. |
17 |
|
18 |
Link 1: https://github.com/jemalloc/jemalloc/commit/c443b67561891ae68d688daf5f8ce37820cdba2b |
19 |
Link 2: https://github.com/jemalloc/jemalloc/commit/3c8c3e9e9b59b6e34a222816a05f0a01a68919b3 |
20 |
Gentoo-Bug: https://bugs.gentoo.org/592420 |
21 |
|
22 |
Package-Manager: portage-2.3.2 |
23 |
|
24 |
.../jemalloc/files/jemalloc-4.2-issue_399.patch | 26 ++++++++++ |
25 |
.../jemalloc/files/jemalloc-4.2-issue_443.patch | 58 ++++++++++++++++++++++ |
26 |
...alloc-4.2.1.ebuild => jemalloc-4.2.1-r1.ebuild} | 2 + |
27 |
3 files changed, 86 insertions(+) |
28 |
|
29 |
diff --git a/dev-libs/jemalloc/files/jemalloc-4.2-issue_399.patch b/dev-libs/jemalloc/files/jemalloc-4.2-issue_399.patch |
30 |
new file mode 100644 |
31 |
index 00000000..da9f2d8 |
32 |
--- /dev/null |
33 |
+++ b/dev-libs/jemalloc/files/jemalloc-4.2-issue_399.patch |
34 |
@@ -0,0 +1,26 @@ |
35 |
+From 3c8c3e9e9b59b6e34a222816a05f0a01a68919b3 Mon Sep 17 00:00:00 2001 |
36 |
+From: Jason Evans <jasone@×××××××××.com> |
37 |
+Date: Mon, 26 Sep 2016 15:55:40 -0700 |
38 |
+Subject: [PATCH] Close file descriptor after reading |
39 |
+ "/proc/sys/vm/overcommit_memory". |
40 |
+ |
41 |
+This bug was introduced by c2f970c32b527660a33fa513a76d913c812dcf7c |
42 |
+(Modify pages_map() to support mapping uncommitted virtual memory.). |
43 |
+ |
44 |
+This resolves #399. |
45 |
+--- |
46 |
+ src/pages.c | 1 + |
47 |
+ 1 file changed, 1 insertion(+) |
48 |
+ |
49 |
+diff --git a/src/pages.c b/src/pages.c |
50 |
+index 2a9b7e3..05b0d69 100644 |
51 |
+--- a/src/pages.c |
52 |
++++ b/src/pages.c |
53 |
+@@ -219,6 +219,7 @@ os_overcommits_proc(void) |
54 |
+ return (false); /* Error. */ |
55 |
+ |
56 |
+ nread = read(fd, &buf, sizeof(buf)); |
57 |
++ close(fd); |
58 |
+ if (nread < 1) |
59 |
+ return (false); /* Error. */ |
60 |
+ /* |
61 |
|
62 |
diff --git a/dev-libs/jemalloc/files/jemalloc-4.2-issue_443.patch b/dev-libs/jemalloc/files/jemalloc-4.2-issue_443.patch |
63 |
new file mode 100644 |
64 |
index 00000000..d2b065a |
65 |
--- /dev/null |
66 |
+++ b/dev-libs/jemalloc/files/jemalloc-4.2-issue_443.patch |
67 |
@@ -0,0 +1,58 @@ |
68 |
+From c443b67561891ae68d688daf5f8ce37820cdba2b Mon Sep 17 00:00:00 2001 |
69 |
+From: Jason Evans <jasone@×××××××××.com> |
70 |
+Date: Sat, 29 Oct 2016 22:41:04 -0700 |
71 |
+Subject: [PATCH] Use syscall(2) rather than {open,read,close}(2) during boot. |
72 |
+ |
73 |
+Some applications wrap various system calls, and if they call the |
74 |
+allocator in their wrappers, unexpected reentry can result. This is not |
75 |
+a general solution (many other syscalls are spread throughout the code), |
76 |
+but this resolves a bootstrapping issue that is apparently common. |
77 |
+ |
78 |
+This resolves #443. |
79 |
+--- |
80 |
+ src/pages.c | 19 +++++++++++++++++++ |
81 |
+ 1 file changed, 19 insertions(+) |
82 |
+ |
83 |
+diff --git a/src/pages.c b/src/pages.c |
84 |
+index 05b0d69..84e2216 100644 |
85 |
+--- a/src/pages.c |
86 |
++++ b/src/pages.c |
87 |
+@@ -207,6 +207,11 @@ os_overcommits_sysctl(void) |
88 |
+ #endif |
89 |
+ |
90 |
+ #ifdef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY |
91 |
++/* |
92 |
++ * Use syscall(2) rather than {open,read,close}(2) when possible to avoid |
93 |
++ * reentry during bootstrapping if another library has interposed system call |
94 |
++ * wrappers. |
95 |
++ */ |
96 |
+ static bool |
97 |
+ os_overcommits_proc(void) |
98 |
+ { |
99 |
+@@ -214,12 +219,26 @@ os_overcommits_proc(void) |
100 |
+ char buf[1]; |
101 |
+ ssize_t nread; |
102 |
+ |
103 |
++#ifdef SYS_open |
104 |
++ fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY); |
105 |
++#else |
106 |
+ fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY); |
107 |
++#endif |
108 |
+ if (fd == -1) |
109 |
+ return (false); /* Error. */ |
110 |
+ |
111 |
++#ifdef SYS_read |
112 |
++ nread = (ssize_t)syscall(SYS_read, fd, &buf, sizeof(buf)); |
113 |
++#else |
114 |
+ nread = read(fd, &buf, sizeof(buf)); |
115 |
++#endif |
116 |
++ |
117 |
++#ifdef SYS_close |
118 |
++ syscall(SYS_close, fd); |
119 |
++#else |
120 |
+ close(fd); |
121 |
++#endif |
122 |
++ |
123 |
+ if (nread < 1) |
124 |
+ return (false); /* Error. */ |
125 |
+ /* |
126 |
|
127 |
diff --git a/dev-libs/jemalloc/jemalloc-4.2.1.ebuild b/dev-libs/jemalloc/jemalloc-4.2.1-r1.ebuild |
128 |
similarity index 95% |
129 |
rename from dev-libs/jemalloc/jemalloc-4.2.1.ebuild |
130 |
rename to dev-libs/jemalloc/jemalloc-4.2.1-r1.ebuild |
131 |
index 8c320ea..c7f3d8a 100644 |
132 |
--- a/dev-libs/jemalloc/jemalloc-4.2.1.ebuild |
133 |
+++ b/dev-libs/jemalloc/jemalloc-4.2.1-r1.ebuild |
134 |
@@ -17,6 +17,8 @@ IUSE="debug static-libs stats" |
135 |
HTML_DOCS=( doc/jemalloc.html ) |
136 |
PATCHES=( "${FILESDIR}/${PN}-3.5.1-strip-optimization.patch" |
137 |
"${FILESDIR}/${PN}-3.5.1_fix_html_install.patch" |
138 |
+ "${FILESDIR}/${PN}-4.2-issue_399.patch" |
139 |
+ "${FILESDIR}/${PN}-4.2-issue_443.patch" |
140 |
) |
141 |
MULTILIB_WRAPPED_HEADERS=( /usr/include/jemalloc/jemalloc.h ) |
142 |
# autotools-utils.eclass auto-adds configure options when static-libs is in IUSE |