diff --git a/.gitignore b/.gitignore index 5838e51..309ce75 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /jemalloc-3.5.1.tar.bz2 /jemalloc-3.6.0.tar.bz2 /jemalloc-4.0.0.tar.bz2 +/jemalloc-4.0.2.tar.bz2 diff --git a/jemalloc-4.0.2.test.oom.patch b/jemalloc-4.0.2.test.oom.patch new file mode 100644 index 0000000..ecf128c --- /dev/null +++ b/jemalloc-4.0.2.test.oom.patch @@ -0,0 +1,117 @@ +From 21523297fcd72128c14b40ebefbf8ccf114fbede Mon Sep 17 00:00:00 2001 +From: Jason Evans +Date: Thu, 17 Sep 2015 15:27:28 -0700 +Subject: [PATCH] Add mallocx() OOM tests. + +--- + src/jemalloc.c | 2 ++ + test/integration/mallocx.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 72 insertions(+) + +diff --git a/src/jemalloc.c b/src/jemalloc.c +index 49c5f2a..5a2d324 100644 +--- a/src/jemalloc.c ++++ b/src/jemalloc.c +@@ -1923,6 +1923,7 @@ imallocx_flags_decode_hard(tsd_t *tsd, size_t size, int flags, size_t *usize, + *alignment = MALLOCX_ALIGN_GET_SPECIFIED(flags); + *usize = sa2u(size, *alignment); + } ++ assert(*usize != 0); + *zero = MALLOCX_ZERO_GET(flags); + if ((flags & MALLOCX_TCACHE_MASK) != 0) { + if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE) +@@ -2267,6 +2268,7 @@ ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size, + */ + usize_max = (alignment == 0) ? s2u(size+extra) : sa2u(size+extra, + alignment); ++ assert(usize_max != 0); + tctx = prof_alloc_prep(tsd, usize_max, prof_active, false); + if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) { + usize = ixallocx_prof_sample(ptr, old_usize, size, extra, +diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c +index 4b0e33f..3973938 100644 +--- a/test/integration/mallocx.c ++++ b/test/integration/mallocx.c +@@ -1,5 +1,74 @@ + #include "test/jemalloc_test.h" + ++static unsigned ++get_nsizes_impl(const char *cmd) ++{ ++ unsigned ret; ++ size_t z; ++ ++ z = sizeof(unsigned); ++ assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0, ++ "Unexpected mallctl(\"%s\", ...) failure", cmd); ++ ++ return (ret); ++} ++ ++static unsigned ++get_nhuge(void) ++{ ++ ++ return (get_nsizes_impl("arenas.nhchunks")); ++} ++ ++static size_t ++get_size_impl(const char *cmd, size_t ind) ++{ ++ size_t ret; ++ size_t z; ++ size_t mib[4]; ++ size_t miblen = 4; ++ ++ z = sizeof(size_t); ++ assert_d_eq(mallctlnametomib(cmd, mib, &miblen), ++ 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd); ++ mib[2] = ind; ++ z = sizeof(size_t); ++ assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0), ++ 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind); ++ ++ return (ret); ++} ++ ++static size_t ++get_huge_size(size_t ind) ++{ ++ ++ return (get_size_impl("arenas.hchunk.0.size", ind)); ++} ++ ++TEST_BEGIN(test_oom) ++{ ++ size_t hugemax, size, alignment; ++ ++ hugemax = get_huge_size(get_nhuge()-1); ++ ++ /* In practice hugemax is too large to be allocated. */ ++ assert_ptr_null(mallocx(hugemax, 0), ++ "Expected OOM for mallocx(size=%#zx, 0)", hugemax); ++ ++#if LG_SIZEOF_PTR == 3 ++ size = ZU(0x8000000000000000); ++ alignment = ZU(0x8000000000000000); ++#else ++ size = ZU(0x80000000); ++ alignment = ZU(0x80000000); ++#endif ++ assert_ptr_null(mallocx(size, MALLOCX_ALIGN(alignment)), ++ "Expected OOM for mallocx(size=%#zx, MALLOCX_ALIGN(%#zx)", size, ++ alignment); ++} ++TEST_END ++ + TEST_BEGIN(test_basic) + { + #define MAXSZ (((size_t)1) << 26) +@@ -96,6 +165,7 @@ main(void) + { + + return (test( ++ test_oom, + test_basic, + test_alignment_and_size)); + } diff --git a/jemalloc.spec b/jemalloc.spec index 5b0084b..a5821e0 100644 --- a/jemalloc.spec +++ b/jemalloc.spec @@ -1,5 +1,5 @@ Name: jemalloc -Version: 4.0.0 +Version: 4.0.2 Release: 1%{?dist} Summary: General-purpose scalable concurrent malloc implementation @@ -7,7 +7,7 @@ Summary: General-purpose scalable concurrent malloc implementation Group: System Environment/Libraries License: BSD URL: http://www.canonware.com/jemalloc/ -Source0: http://www.canonware.com/download/jemalloc/%{name}-%{version}.tar.bz2 +Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # ARMv5tel has no atomic operations @@ -15,7 +15,9 @@ Patch2: jemalloc-armv5-force-atomic.patch # RHEL5/POWER has no atomic operations Patch3: jemalloc-3.0.0.atomic_h_ppc_32bit_operations.patch Patch4: jemalloc-3.6.0.no_explicit_altivec.patch -Patch6: jemalloc-4.0.0.negative_bitshift.patch +# According to upstream, this test is non-critical. It also only fails on i386 +Patch6: jemalloc-4.0.2.test.oom.patch + BuildRequires: /usr/bin/xsltproc %ifnarch s390 BuildRequires: valgrind-devel @@ -44,7 +46,9 @@ developing applications that use %{name}. %patch4 -b .ppc %endif %endif -%patch6 -p1 +%ifarch i386 i486 i586 i686 +%patch6 -p1 -R -b .i386 +%endif %build %ifarch i686 @@ -103,6 +107,11 @@ rm -rf %{buildroot} %postun -p /sbin/ldconfig %changelog +* Tue Sep 22 2015 Ingvar Hagelund - 4.0.2-1 +- New upstream release +- Added a patch removing a non-critical test that fails on i386 +- Removed now included negative bitshift patch. + * Wed Aug 19 2015 Ingvar Hagelund - 4.0.0-1 - New upstream release - Removed the no-pprof patch, as jemalloc now comes with its own prof variant diff --git a/sources b/sources index d9fb409..23e6d40 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -87ceedfb5427676f4e059a42d939b0df jemalloc-4.0.0.tar.bz2 +e1b40f75a5a8a08e8f76eb3a6ec67073 jemalloc-4.0.2.tar.bz2