Gentoo Archives: gentoo-commits

From: Ian Stakenvicius <axs@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/jemalloc/, dev-libs/jemalloc/files/
Date: Tue, 29 Mar 2016 02:16:20
Message-Id: 1459217759.909ce41704c037d6e5ddc9fb68f0c8de90f8b800.axs@gentoo
1 commit: 909ce41704c037d6e5ddc9fb68f0c8de90f8b800
2 Author: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 29 02:14:44 2016 +0000
4 Commit: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 29 02:15:59 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=909ce417
7
8 dev-libs/jemalloc: version bump to jemalloc-4.1.0
9
10 Included upstream commit 33184bf69813087 as requested by developers of dev-lang/rust,
11 to allow system jemalloc to be used with rust.
12
13 Package-Manager: portage-2.2.26
14
15 dev-libs/jemalloc/Manifest | 1 +
16 .../files/jemalloc-4.1-fix_stack_corruption.patch | 70 ++++++++++++++++++++++
17 dev-libs/jemalloc/jemalloc-4.1.0.ebuild | 48 +++++++++++++++
18 3 files changed, 119 insertions(+)
19
20 diff --git a/dev-libs/jemalloc/Manifest b/dev-libs/jemalloc/Manifest
21 index 005eea5..9a35203 100644
22 --- a/dev-libs/jemalloc/Manifest
23 +++ b/dev-libs/jemalloc/Manifest
24 @@ -2,3 +2,4 @@ DIST jemalloc-2.2.5.tar.bz2 224118 SHA256 efcc9636757bd7f53a0fde084c2988bfe26f28
25 DIST jemalloc-3.3.1.tar.bz2 252997 SHA256 35c433cc1df5cdf9eb58b7980338552fc1d7aa64f89fe5643a972ccedb7cf20a SHA512 32814e8678af4954e26c0c0a0e5d06aba8f3844205fe212c5e41929dfab6a94ff11127a9238b5c18d72749827c467ecb874b8f3a9bc161cf1afdf4ea84c58690 WHIRLPOOL 35e8948e18ea7111ae830a8245be995b35f44ed2c2f687f706ee6941c78350c2cfaabefba223c4433069de47a9f92d621feaf176ec0c728e513e5f076e5fc874
26 DIST jemalloc-3.6.0.tar.bz2 338964 SHA256 e16c2159dd3c81ca2dc3b5c9ef0d43e1f2f45b04548f42db12e7c12d7bdf84fe SHA512 ebe7c64558a87a735b5906d5cb7527c241664eeae7328538675a12eabe7a1004be0f8766a3bd2a78e61334b196ca7ffc0ee8b8ff59167922a35f126cd1e76e43 WHIRLPOOL d5452005951b10d9d529349481779d79361ec8d8ac1f36f4b54408b5e0184f35d79fee8378188d98f1b8e41ae13557a2cf41ab849b68856ba69f33870fe6e980
27 DIST jemalloc-4.0.4.tar.bz2 391483 SHA256 3fda8d8d7fcd041aa0bebbecd45c46b28873cf37bd36c56bf44961b36d0f42d0 SHA512 93be0551a80d5f5dc3a1044ef3d5f06c5ce65f3c1fd753743ee64340b841fc2d7902178774ab71eaa633f68abad44109870eb84159679fdc8ce6d93db3a53112 WHIRLPOOL c8bc1a81555b30ff519fda90bfbcfcdb6c9e370ba7478bca17058e58e08c36d20a1995ab12d5374d4edb9cdd2469748517a6f1795a24667c5f798c4c0c756a9c
28 +DIST jemalloc-4.1.0.tar.bz2 412900 SHA256 fad06d714f72adb4265783bc169c6d98eeb032d57ba02d87d1dcb4a2d933ec8e SHA512 12433101936a104115d8d93991b4849daf897bd39d6c28b1235215c7abc627163a70d19259fb1f2eeb0cdd66cfe889c2e40eb77dccee6debd73b1a4313d0de73 WHIRLPOOL 0305d1cc715c565749c5e9c2de396d349c0d79513da80b461324c82f880c6a070a932cea19802ac809810fe01690dcb24047914f937ddf167a990cf7b4110f0c
29
30 diff --git a/dev-libs/jemalloc/files/jemalloc-4.1-fix_stack_corruption.patch b/dev-libs/jemalloc/files/jemalloc-4.1-fix_stack_corruption.patch
31 new file mode 100644
32 index 0000000..f36c188
33 --- /dev/null
34 +++ b/dev-libs/jemalloc/files/jemalloc-4.1-fix_stack_corruption.patch
35 @@ -0,0 +1,70 @@
36 +From 33184bf69813087bf1885b0993685f9d03320c69 Mon Sep 17 00:00:00 2001
37 +From: Dmitri Smirnov <dmitrism@×××××××××.com>
38 +Date: Mon, 29 Feb 2016 14:30:19 -0800
39 +Subject: [PATCH] Fix stack corruption and uninitialized var warning
40 +
41 +Stack corruption happens in x64 bit
42 +
43 +This resolves #347.
44 +---
45 + src/arena.c | 2 +-
46 + test/unit/hash.c | 13 +++++++------
47 + 2 files changed, 8 insertions(+), 7 deletions(-)
48 +
49 +diff --git a/src/arena.c b/src/arena.c
50 +index 99e20fd..965c0fe 100644
51 +--- a/src/arena.c
52 ++++ b/src/arena.c
53 +@@ -2423,7 +2423,7 @@ arena_malloc_large(tsd_t *tsd, arena_t *arena, szind_t binind, bool zero)
54 + uintptr_t random_offset;
55 + arena_run_t *run;
56 + arena_chunk_map_misc_t *miscelm;
57 +- UNUSED bool idump;
58 ++ UNUSED bool idump JEMALLOC_CC_SILENCE_INIT(false);
59 +
60 + /* Large allocation. */
61 + usize = index2size(binind);
62 +diff --git a/test/unit/hash.c b/test/unit/hash.c
63 +index f50ba81..010c9d7 100644
64 +--- a/test/unit/hash.c
65 ++++ b/test/unit/hash.c
66 +@@ -64,14 +64,15 @@ static void
67 + hash_variant_verify_key(hash_variant_t variant, uint8_t *key)
68 + {
69 + const int hashbytes = hash_variant_bits(variant) / 8;
70 +- VARIABLE_ARRAY(uint8_t, hashes, hashbytes * 256);
71 ++ const int hashes_size = hashbytes * 256;
72 ++ VARIABLE_ARRAY(uint8_t, hashes, hashes_size);
73 + VARIABLE_ARRAY(uint8_t, final, hashbytes);
74 + unsigned i;
75 + uint32_t computed, expected;
76 +
77 + memset(key, 0, KEY_SIZE);
78 +- memset(hashes, 0, sizeof(hashes));
79 +- memset(final, 0, sizeof(final));
80 ++ memset(hashes, 0, hashes_size);
81 ++ memset(final, 0, hashbytes);
82 +
83 + /*
84 + * Hash keys of the form {0}, {0,1}, {0,1,2}, ..., {0,1,...,255} as the
85 +@@ -102,17 +103,17 @@ hash_variant_verify_key(hash_variant_t variant, uint8_t *key)
86 + /* Hash the result array. */
87 + switch (variant) {
88 + case hash_variant_x86_32: {
89 +- uint32_t out = hash_x86_32(hashes, hashbytes*256, 0);
90 ++ uint32_t out = hash_x86_32(hashes, hashes_size, 0);
91 + memcpy(final, &out, sizeof(out));
92 + break;
93 + } case hash_variant_x86_128: {
94 + uint64_t out[2];
95 +- hash_x86_128(hashes, hashbytes*256, 0, out);
96 ++ hash_x86_128(hashes, hashes_size, 0, out);
97 + memcpy(final, out, sizeof(out));
98 + break;
99 + } case hash_variant_x64_128: {
100 + uint64_t out[2];
101 +- hash_x64_128(hashes, hashbytes*256, 0, out);
102 ++ hash_x64_128(hashes, hashes_size, 0, out);
103 + memcpy(final, out, sizeof(out));
104 + break;
105 + } default: not_reached();
106
107 diff --git a/dev-libs/jemalloc/jemalloc-4.1.0.ebuild b/dev-libs/jemalloc/jemalloc-4.1.0.ebuild
108 new file mode 100644
109 index 0000000..a03d99d
110 --- /dev/null
111 +++ b/dev-libs/jemalloc/jemalloc-4.1.0.ebuild
112 @@ -0,0 +1,48 @@
113 +# Copyright 1999-2016 Gentoo Foundation
114 +# Distributed under the terms of the GNU General Public License v2
115 +# $Id$
116 +
117 +EAPI=6
118 +
119 +inherit toolchain-funcs multilib-build
120 +
121 +DESCRIPTION="Jemalloc is a general-purpose scalable concurrent allocator"
122 +HOMEPAGE="http://www.canonware.com/jemalloc/"
123 +SRC_URI="http://www.canonware.com/download/${PN}/${P}.tar.bz2"
124 +
125 +LICENSE="BSD"
126 +SLOT="0/2"
127 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
128 +IUSE="debug static-libs stats"
129 +HTML_DOCS=( doc/jemalloc.html )
130 +PATCHES=( "${FILESDIR}/${PN}-3.5.1-strip-optimization.patch"
131 + "${FILESDIR}/${PN}-3.5.1_fix_html_install.patch"
132 + "${FILESDIR}/${PN}-4.1-fix_stack_corruption.patch"
133 +)
134 +MULTILIB_WRAPPED_HEADERS=( /usr/include/jemalloc/jemalloc.h )
135 +# autotools-utils.eclass auto-adds configure options when static-libs is in IUSE
136 +# but jemalloc doesn't implement them in its configure; need this here to
137 +# supress the warnings until automagic is removed from the eclass
138 +QA_CONFIGURE_OPTIONS="--enable-static --disable-static --enable-shared --disable-shared"
139 +
140 +multilib_src_configure() {
141 + ECONF_SOURCE="${S}" econf \
142 + $(use_enable debug)
143 + $(use_enable stats)
144 +}
145 +
146 +multilib_src_install() {
147 + # Copy man file which the Makefile looks for
148 + cp "${S}/doc/jemalloc.3" "${BUILD_DIR}/doc" || die
149 + emake DESTDIR="${D}" install
150 +}
151 +
152 +multilib_src_install_all() {
153 + if [[ ${CHOST} == *-darwin* ]] ; then
154 + # fixup install_name, #437362
155 + install_name_tool \
156 + -id "${EPREFIX}"/usr/$(get_libdir)/libjemalloc.1.dylib \
157 + "${ED}"/usr/$(get_libdir)/libjemalloc.1.dylib || die
158 + fi
159 + use static-libs || find "${ED}" -name '*.a' -delete
160 +}