Add valgrind-3.11.0-deduppoolalloc.patch

This commit is contained in:
Mark Wielaard 2016-04-28 22:50:33 +02:00
parent c993ca9b53
commit 05e63997d5
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,56 @@
commit 46809ccf0281e7556e55f50f25ad5c811fad6ba3
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Feb 14 22:14:19 2016 +0000
Fix Bug 359133 - m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion 'eltSzB <= ddpa->poolSzB' failed.
When the elt to allocate is bigger than the pool size, allocate
a specific pool only for this element.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15787 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
index 92016d8..f7ebd27 100644
--- a/coregrind/m_deduppoolalloc.c
+++ b/coregrind/m_deduppoolalloc.c
@@ -255,7 +255,6 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
ht_node *ht_ins;
vg_assert(ddpa);
vg_assert(ddpa->ht_elements);
- vg_assert (eltSzB <= ddpa->poolSzB);
ddpa->nr_alloc_calls++;
@@ -272,15 +271,24 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
and insert it in the hash table of inserted elements. */
// Add a new pool or grow pool if not enough space in the current pool
- if (UNLIKELY(ddpa->curpool_free == NULL
- || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
- ddpa_add_new_pool_or_grow (ddpa);
+ if (eltSzB + ddpa->eltAlign > ddpa->poolSzB) {
+ // Element (+eltAlign for worst case) bigger than the pool size
+ // => allocate a specific pool just for this element
+ UChar *newpool = ddpa->alloc_fn (ddpa->cc, eltSzB + ddpa->eltAlign);
+ /* add to our collection of pools */
+ VG_(addToXA)( ddpa->pools, &newpool );
+ elt_ins = ddpa_align (ddpa, newpool);
+ } else {
+ if (UNLIKELY(ddpa->curpool_free == NULL
+ || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
+ ddpa_add_new_pool_or_grow (ddpa);
+ }
+ elt_ins = ddpa->curpool_free;
+ ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
}
- elt_ins = ddpa->curpool_free;
- VG_(memcpy)(elt_ins, elt, eltSzB);
- ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
+ VG_(memcpy)(elt_ins, elt, eltSzB);
ht_ins = VG_(allocEltPA) (ddpa->ht_node_pa);
ht_ins->key = ht_elt.key;
ht_ins->eltSzB = eltSzB;

View File

@ -154,6 +154,9 @@ Patch34: valgrind-3.11.0-gdb-test-filters.patch
# KDE#361226 s390x: risbgn (EC59) not implemented
Patch35: valgrind-3.11.0-s390x-risbgn.patch
# KDE#359133 m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion failed
Patch36: valgrind-3.11.0-deduppoolalloc.patch
%if %{build_multilib}
# Ensure glibc{,-devel} is installed for both multilib arches
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -297,6 +300,7 @@ chmod 755 memcheck/tests/arm64-linux/filter_stderr
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%build
# We need to use the software collection compiler and binutils if available.
@ -489,6 +493,9 @@ echo ===============END TESTING===============
%endif
%changelog
* Thu Apr 28 2016 Mark Wielaard <mjw@redhat.com>
- Add valgrind-3.11.0-deduppoolalloc.patch
* Fri Apr 15 2016 Mark Wielaard <mjw@redhat.com> - 3.11.0-20
- Update valgrind-3.11.0-cxx-freeres.patch (x86 final_tidyup fix)
- Add valgrind-3.11.0-s390x-risbgn.patch