Add valgrind-3.11.0-sighandler-stack.patch

This commit is contained in:
Mark Wielaard 2016-07-21 14:45:04 +02:00
parent 7c3a67dda2
commit 1e2b8b0720
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,54 @@
commit 13747d21fe69dd730fc4bbe21fc9320d349b41db
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Jul 10 21:17:58 2016 +0000
Fix 365273 - Invalid write to stack location reported after signal handler runs
Analysis and patch by Earl Chew
Tested on x86/amd64/ppc64
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15902 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index 3e8326f..9146d0c 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -2519,6 +2519,7 @@ void async_signalhandler ( Int sigNo,
Bool VG_(extend_stack)(ThreadId tid, Addr addr)
{
SizeT udelta;
+ Addr new_stack_base;
/* Get the segment containing addr. */
const NSegment* seg = VG_(am_find_nsegment)(addr);
@@ -2536,14 +2537,15 @@ Bool VG_(extend_stack)(ThreadId tid, Addr addr)
vg_assert(seg_next != NULL);
udelta = VG_PGROUNDUP(seg_next->start - addr);
+ new_stack_base = seg_next->start - udelta;
VG_(debugLog)(1, "signals",
- "extending a stack base 0x%lx down by %lu\n",
- seg_next->start, udelta);
+ "extending a stack base 0x%lx down by %lu"
+ " new base 0x%lx to cover 0x%lx\n",
+ seg_next->start, udelta, new_stack_base, addr);
Bool overflow;
if (! VG_(am_extend_into_adjacent_reservation_client)
( seg_next->start, -(SSizeT)udelta, &overflow )) {
- Addr new_stack_base = seg_next->start - udelta;
if (overflow)
VG_(umsg)("Stack overflow in thread #%u: can't grow stack to %#lx\n",
tid, new_stack_base);
@@ -2555,7 +2557,7 @@ Bool VG_(extend_stack)(ThreadId tid, Addr addr)
/* When we change the main stack, we have to let the stack handling
code know about it. */
- VG_(change_stack)(VG_(clstk_id), addr, VG_(clstk_end));
+ VG_(change_stack)(VG_(clstk_id), new_stack_base, VG_(clstk_end));
if (VG_(clo_sanity_level) > 2)
VG_(sanity_check_general)(False);

View File

@ -175,6 +175,9 @@ Patch41: valgrind-3.11.0-shr.patch
# KDE#359952 - Enable PCMPxSTRx cases 0x70 and 0x19.
Patch42: valgrind-3.11.0-pcmpxstrx-0x70-0x19.patch
# KDE#365273 - Invalid write to stack location reported after signal handler
Patch43: valgrind-3.11.0-sighandler-stack.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
@ -326,6 +329,7 @@ chmod 755 memcheck/tests/arm64-linux/filter_stderr
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%build
# We need to use the software collection compiler and binutils if available.
@ -523,6 +527,7 @@ echo ===============END TESTING===============
- Add valgrind-3.11.0-shr.patch
- Add valgrind-3.11.0-pcmpxstrx-0x70-0x19.patch
- Update valgrind-3.11.0-wrapmalloc.patch
- Add valgrind-3.11.0-sighandler-stack.patch
* Tue Jun 21 2016 Mark Wielaard <mjw@redhat.com> - 3.11.0-23
- Update valgrind-3.11.0-ppoll-mask.patch (#1344082)