3.11.0-6 - Add valgrind-3.11.0-aspacemgr.patch

Resolves: #1283774
Valgrind: FATAL: aspacem assertion failed
This commit is contained in:
Mark Wielaard 2016-01-17 00:52:30 +01:00
parent 20a133add0
commit 79b01de1d0
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
commit b28a423827a1c7917c6f3f3eba23b9432077dfbd
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sat Jan 16 21:44:31 2016 +0000
In ML_(am_allocate_segname) do not set the reference count of the
slot to 1. Rather do that in add_segment which is where the segment
refering to that name actually comes into existence.
Properly handle the case in add_segment where the to-be-added segment
and one (or more) of the segments it replaces have the same name
This may occur when doing a mremap.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15761 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index 0a8f675..f6c1a41 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -1445,6 +1445,15 @@ static void add_segment ( const NSegment* seg )
split_nsegments_lo_and_hi( sStart, sEnd, &iLo, &iHi );
+ /* Increase the reference count of SEG's name. We need to do this
+ *before* decreasing the reference count of the names of the replaced
+ segments. Consider the case where the segment name of SEG and one of
+ the replaced segments are the same. If the refcount of that name is 1,
+ then decrementing first would put the slot for that name on the free
+ list. Attempting to increment the refcount later would then fail
+ because the slot is no longer allocated. */
+ ML_(am_inc_refcount)(seg->fnIdx);
+
/* Now iLo .. iHi inclusive is the range of segment indices which
seg will replace. If we're replacing more than one segment,
slide those above the range down to fill the hole. Before doing
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
index ef3d3ef..8e74356 100644
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
@@ -309,7 +309,7 @@ ML_(am_allocate_segname)(const HChar *name)
freeslot_chain = next_freeslot;
else
put_slotindex(prev, next_freeslot);
- put_refcount(ix, 1);
+ put_refcount(ix, 0);
put_slotsize(ix, size);
VG_(strcpy)(segnames + ix, name);
++num_segnames;
@@ -336,7 +336,7 @@ ML_(am_allocate_segname)(const HChar *name)
/* copy it in */
ix = segnames_used;
- put_refcount(ix, 1);
+ put_refcount(ix, 0);
put_slotsize(ix, len + 1);
VG_(strcpy)(segnames + ix, name);
segnames_used += need;

View File

@ -3,7 +3,7 @@
Summary: Tool for finding memory management bugs in programs Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind Name: %{?scl_prefix}valgrind
Version: 3.11.0 Version: 3.11.0
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ License: GPLv2+
URL: http://www.valgrind.org/ URL: http://www.valgrind.org/
@ -73,6 +73,9 @@ Patch8: valgrind-3.11.0-s390-hwcap.patch
# KDE#355188 valgrind should intercept all malloc related global functions # KDE#355188 valgrind should intercept all malloc related global functions
Patch9: valgrind-3.11.0-wrapmalloc.patch Patch9: valgrind-3.11.0-wrapmalloc.patch
# RHBZ#1283774 - Valgrind: FATAL: aspacem assertion failed
Patch10: valgrind-3.11.0-aspacemgr.patch
%if %{build_multilib} %if %{build_multilib}
# Ensure glibc{,-devel} is installed for both multilib arches # 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 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -186,6 +189,7 @@ Valgrind User Manual for details.
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1
%build %build
# We need to use the software collection compiler and binutils if available. # We need to use the software collection compiler and binutils if available.
@ -361,6 +365,9 @@ echo ===============END TESTING===============
%endif %endif
%changelog %changelog
* Sat Jan 17 2016 Mark Wielaard <mjw@redhat.com> - 3.11.0-6
- Add valgrind-3.11.0-aspacemgr.patch (#1283774)
* Sun Nov 15 2015 Mark Wielaard <mjw@redhat.com> - 3.11.0-5 * Sun Nov 15 2015 Mark Wielaard <mjw@redhat.com> - 3.11.0-5
- Add valgrind-3.11.0-wrapmalloc.patch - Add valgrind-3.11.0-wrapmalloc.patch