From 5ca6500892c88858634e62dc94d96e349664326b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Feb 2017 16:37:24 +0100 Subject: [PATCH] Add valgrind-3.12.0-exit_group.patch --- valgrind-3.12.0-exit_group.patch | 52 ++++++++++++++++++++++++++++++++ valgrind.spec | 5 +++ 2 files changed, 57 insertions(+) create mode 100644 valgrind-3.12.0-exit_group.patch diff --git a/valgrind-3.12.0-exit_group.patch b/valgrind-3.12.0-exit_group.patch new file mode 100644 index 0000000..bd07d3f --- /dev/null +++ b/valgrind-3.12.0-exit_group.patch @@ -0,0 +1,52 @@ +commit 18b3ffc1a8dc951d8a8cdb076e7e30aafc216571 +Author: philippe +Date: Sat Nov 19 14:54:44 2016 +0000 + + Fix 372504 Hanging on exit_group + + Note that it is unclear if the PRE syscall for rt_sigsuspend + is properly setting up a temporary mask in the thread state + tmp_sig_mask: if an handler is called while a thread is + calling sigsuspend, the mask during the handler run must be + the temporary mask set by sigsuspend. + It is not clear if/where the valgrind sigframe builder/handler + sets the tmp_sig_mask to the value as expected by the user + (i.e. the value of the temporary mask which was given to + the sigsuspend syscall) + + + + git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16141 a5019735-40e9-0310-863c-91ae7b9d1cf9 + +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index 1dcb95d..fda8dd1 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -3558,6 +3558,12 @@ PRE(sys_rt_sigsuspend) + PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size) + if (ARG1 != (Addr)NULL) { + PRE_MEM_READ( "rt_sigsuspend(mask)", ARG1, sizeof(vki_sigset_t) ); ++ VG_(sigdelset)((vki_sigset_t*)ARG1, VG_SIGVGKILL); ++ /* We cannot mask VG_SIGVGKILL, as otherwise this thread would not ++ be killable by VG_(nuke_all_threads_except). ++ We thus silently ignore the user request to mask this signal. ++ Note that this is similar to what is done for e.g. ++ sigprocmask (see m_signals.c calculate_SKSS_from_SCSS). */ + } + } + +diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h +index 861f233..f3d956c 100644 +--- a/coregrind/pub_core_threadstate.h ++++ b/coregrind/pub_core_threadstate.h +@@ -354,7 +354,9 @@ typedef struct { + different values is during the execution of a sigsuspend, where + tmp_sig_mask is the temporary mask which sigsuspend installs. + It is only consulted to compute the signal mask applied to a +- signal handler. */ ++ signal handler. ++ PW Nov 2016 : it is not clear if and where this tmp_sig_mask ++ is set when an handler runs "inside" a sigsuspend. */ + vki_sigset_t tmp_sig_mask; + + /* A little signal queue for signals we can't get the kernel to diff --git a/valgrind.spec b/valgrind.spec index ba61c89..01285b3 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -95,6 +95,9 @@ Patch9: valgrind-3.12.0-clone-spawn.patch # KDE#372600 process loops forever when fatal signals are arriving quickly Patch10: valgrind-3.12.0-quick-fatal-sigs.patch +# KDE#372504 Hanging on exit_group +Patch11: valgrind-3.12.0-exit_group.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 @@ -214,6 +217,7 @@ Valgrind User Manual for details. %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 %build # We need to use the software collection compiler and binutils if available. @@ -412,6 +416,7 @@ echo ===============END TESTING=============== - Add valgrind-3.12.0-arm64-hint.patch - Add valgrind-3.12.0-clone-spawn.patch - Add valgrind-3.12.0-quick-fatal-sigs.patch +- Add valgrind-3.12.0-exit_group.patch * Fri Feb 17 2017 Mark Wielaard - 3.12.0-5 - Add valgrind-3.12.0-ppc64-r2.patch (#1424367)