diff --git a/backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch b/backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch new file mode 100644 index 0000000000000000000000000000000000000000..33a18af4cce7d717f734d2822c79bb8874aa8bb0 --- /dev/null +++ b/backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch @@ -0,0 +1,19 @@ +diff -Nur jemalloc-5.2.1/src/arena.c tmp/src/arena.c +--- jemalloc-5.2.1/src/arena.c 2019-08-06 04:02:00.000000000 +0800 ++++ tmp/src/arena.c 2021-11-03 10:23:41.243648055 +0800 +@@ -199,13 +199,12 @@ + malloc_mutex_lock(tsdn, &arena->tcache_ql_mtx); + cache_bin_array_descriptor_t *descriptor; + ql_foreach(descriptor, &arena->cache_bin_array_descriptor_ql, link) { +- szind_t i = 0; +- for (; i < SC_NBINS; i++) { ++ for (szind_t i = 0; i < SC_NBINS; i++) { + cache_bin_t *tbin = &descriptor->bins_small[i]; + arena_stats_accum_zu(&astats->tcache_bytes, + tbin->ncached * sz_index2size(i)); + } +- for (; i < nhbins; i++) { ++ for (szind_t i = 0; i < nhbins - SC_NBINS; i++) { + cache_bin_t *tbin = &descriptor->bins_large[i]; + arena_stats_accum_zu(&astats->tcache_bytes, + tbin->ncached * sz_index2size(i)); diff --git a/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch b/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch new file mode 100644 index 0000000000000000000000000000000000000000..bc2cccb5412c69d0fdf33d9495028aac4ebdfc92 --- /dev/null +++ b/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch @@ -0,0 +1,26 @@ +diff -Nur jemalloc-5.2.1/include/jemalloc/internal/hash.h tmp/include/jemalloc/internal/hash.h +--- jemalloc-5.2.1/include/jemalloc/internal/hash.h 2019-08-06 04:02:00.000000000 +0800 ++++ tmp/include/jemalloc/internal/hash.h 2021-11-16 10:49:41.199628212 +0800 +@@ -182,19 +182,19 @@ + case 13: k4 ^= tail[12] << 0; + k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4; + JEMALLOC_FALLTHROUGH +- case 12: k3 ^= tail[11] << 24; JEMALLOC_FALLTHROUGH ++ case 12: k3 ^= (uint32_t) tail[11] << 24; JEMALLOC_FALLTHROUGH + case 11: k3 ^= tail[10] << 16; JEMALLOC_FALLTHROUGH + case 10: k3 ^= tail[ 9] << 8; JEMALLOC_FALLTHROUGH + case 9: k3 ^= tail[ 8] << 0; + k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3; + JEMALLOC_FALLTHROUGH +- case 8: k2 ^= tail[ 7] << 24; JEMALLOC_FALLTHROUGH ++ case 8: k2 ^= (uint32_t) tail[ 7] << 24; JEMALLOC_FALLTHROUGH + case 7: k2 ^= tail[ 6] << 16; JEMALLOC_FALLTHROUGH + case 6: k2 ^= tail[ 5] << 8; JEMALLOC_FALLTHROUGH + case 5: k2 ^= tail[ 4] << 0; + k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2; + JEMALLOC_FALLTHROUGH +- case 4: k1 ^= tail[ 3] << 24; JEMALLOC_FALLTHROUGH ++ case 4: k1 ^= (uint32_t) tail[ 3] << 24; JEMALLOC_FALLTHROUGH + case 3: k1 ^= tail[ 2] << 16; JEMALLOC_FALLTHROUGH + case 2: k1 ^= tail[ 1] << 8; JEMALLOC_FALLTHROUGH + case 1: k1 ^= tail[ 0] << 0; diff --git a/backport-Jemalloc-5.2.1-patch-3-fix-tcaches-mutex-pre-post-fork-handling.patch b/backport-Jemalloc-5.2.1-patch-3-fix-tcaches-mutex-pre-post-fork-handling.patch new file mode 100644 index 0000000000000000000000000000000000000000..fc5a5a7be8251a0da31895532d6cdbc5513516c0 --- /dev/null +++ b/backport-Jemalloc-5.2.1-patch-3-fix-tcaches-mutex-pre-post-fork-handling.patch @@ -0,0 +1,28 @@ +diff -Nur jemalloc-5.2.1/src/tcache.c tmp/src/tcache.c +--- jemalloc-5.2.1/src/tcache.c 2019-08-06 04:02:00.000000000 +0800 ++++ tmp/src/tcache.c 2021-11-16 19:12:46.889312051 +0800 +@@ -778,21 +778,15 @@ + + void + tcache_prefork(tsdn_t *tsdn) { +- if (!config_prof && opt_tcache) { +- malloc_mutex_prefork(tsdn, &tcaches_mtx); +- } ++ malloc_mutex_prefork(tsdn, &tcaches_mtx); + } + + void + tcache_postfork_parent(tsdn_t *tsdn) { +- if (!config_prof && opt_tcache) { +- malloc_mutex_postfork_parent(tsdn, &tcaches_mtx); +- } ++ malloc_mutex_postfork_parent(tsdn, &tcaches_mtx); + } + + void + tcache_postfork_child(tsdn_t *tsdn) { +- if (!config_prof && opt_tcache) { +- malloc_mutex_postfork_child(tsdn, &tcaches_mtx); +- } ++ malloc_mutex_postfork_child(tsdn, &tcaches_mtx); + } diff --git a/jemalloc-5.1.0.tar.bz2 b/jemalloc-5.1.0.tar.bz2 deleted file mode 100644 index 6f12b60f0a945085d90546ac393cf5623259a1cc..0000000000000000000000000000000000000000 Binary files a/jemalloc-5.1.0.tar.bz2 and /dev/null differ diff --git a/jemalloc-5.2.1.tar.bz2 b/jemalloc-5.2.1.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..75baa3f9a1c21f350f28521657c1d907e6235a34 Binary files /dev/null and b/jemalloc-5.2.1.tar.bz2 differ diff --git a/jemalloc.spec b/jemalloc.spec index 1c570e329029f583191a8f130878c0663a51cc04..8fab9f297efa3c9bbeb488b5a2dbd05219fd0d03 100644 --- a/jemalloc.spec +++ b/jemalloc.spec @@ -11,13 +11,16 @@ %endif Name: jemalloc -Version: 5.1.0 -Release: 4 +Version: 5.2.1 +Release: 1 Summary: General-purpose scalable concurrent malloc implementation License: BSD URL: http://www.canonware.com/jemalloc/ Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2 +Patch1: backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch +Patch2: backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch +Patch3: backport-Jemalloc-5.2.1-patch-3-fix-tcaches-mutex-pre-post-fork-handling.patch BuildRequires: libxslt perl-generators gcc %description @@ -47,10 +50,8 @@ uname -a %make_build %check -%if %{?_with_check:1}%{!?_with_check:0} LD_LIBRARY_PATH=%{buildroot}%{_libdir} make test %{?_smp_mflags} make check -%endif %install %make_install @@ -81,6 +82,9 @@ make check %{_mandir}/man3/jemalloc.3* %changelog +* Thu Dec 30 2021 xigaoxinyan - 5.2.1-1 +- Update jemlloc + * Wed Jun 02 2021 wulei - 5.1.0-4 - fixes failed: no acceptable C compiler found in $PATH