From c2ff32f41e9776e11ecb70d2beedd25e3bd0259f Mon Sep 17 00:00:00 2001 From: g00523939 Date: Wed, 3 Nov 2021 15:51:08 +0800 Subject: [PATCH] fix large bin index accessed through cache bin descriptor --- ...ccessed-through-cache-bin-descriptor.patch | 19 +++++++++++++++++++ jemalloc.spec | 6 +++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch 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 0000000..33a18af --- /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/jemalloc.spec b/jemalloc.spec index 25ad0f0..ab8bd1d 100644 --- a/jemalloc.spec +++ b/jemalloc.spec @@ -12,12 +12,13 @@ Name: jemalloc Version: 5.2.1 -Release: 1 +Release: 2 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 BuildRequires: libxslt perl-generators gcc %description @@ -81,6 +82,9 @@ make check %{_mandir}/man3/jemalloc.3* %changelog +* Wed Nov 3 2021 guominghong - 5.2.1-1 +- Fix large bin index accessed through cache bin descriptor + * Tue Jul 20 2021 weidong - 5.2.1-1 - Update jemlloc -- Gitee