|
From: <sv...@va...> - 2016-10-05 05:11:30
|
Author: sewardj
Date: Wed Oct 5 06:11:23 2016
New Revision: 16011
Log:
Merge, from trunk:
r15982 Fix #361615 - Inconsistent termination for multithreaded process
terminated by signal
r15983 Fix warning introduced by revision 15982
Added:
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.c
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.c
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.stderr.exp
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.stderr.exp
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.vgtest
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.vgtest
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c
branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h
branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 06:11:23 2016
@@ -138,6 +138,7 @@
361207 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 2
361226 s390x: risbgn (EC59) not implemented
361354 ppc64[le]: wire up separate socketcalls system calls
+361615 Inconsistent termination for multithreaded process terminated by signal
361926 Unhandled Solaris syscall: sysfs(84)
362009 Valgrind dumps core on unimplemented functionality before threads are created
362329 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 3
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c Wed Oct 5 06:11:23 2016
@@ -2705,7 +2705,11 @@
sys_exit, do likewise; if the (last) thread stopped due to a fatal
signal, terminate the entire system with that same fatal signal. */
VG_(debugLog)(1, "core_os",
- "VG_(terminate_NORETURN)(tid=%u)\n", tid);
+ "VG_(terminate_NORETURN)(tid=%u) schedretcode %s"
+ " os_state.exit_code %ld fatalsig %d\n",
+ tid, VG_(name_of_VgSchedReturnCode)(tids_schedretcode),
+ VG_(threads)[tid].os_state.exitcode,
+ VG_(threads)[tid].os_state.fatalsig);
switch (tids_schedretcode) {
case VgSrc_ExitThread: /* the normal way out (Linux, Solaris) */
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c Wed Oct 5 06:11:23 2016
@@ -1653,11 +1653,6 @@
}
-/*
- This causes all threads to forceably exit. They aren't actually
- dead by the time this returns; you need to call
- VG_(reap_threads)() to wait for them.
- */
void VG_(nuke_all_threads_except) ( ThreadId me, VgSchedReturnCode src )
{
ThreadId tid;
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c Wed Oct 5 06:11:23 2016
@@ -1654,8 +1654,8 @@
/*
Perform the default action of a signal. If the signal is fatal, it
- marks all threads as needing to exit, but it doesn't actually kill
- the process or thread.
+ terminates all other threads, but it doesn't actually kill
+ the process and calling thread.
If we're not being quiet, then print out some more detail about
fatal signals (esp. core dumping signals).
@@ -1933,12 +1933,13 @@
VG_(setrlimit)(VKI_RLIMIT_CORE, &zero);
}
- /* stash fatal signal in main thread */
// what's this for?
//VG_(threads)[VG_(master_tid)].os_state.fatalsig = sigNo;
- /* everyone dies */
+ /* everyone but tid dies */
VG_(nuke_all_threads_except)(tid, VgSrc_FatalSig);
+ VG_(reap_threads)(tid);
+ /* stash fatal signal in this thread */
VG_(threads)[tid].exitreason = VgSrc_FatalSig;
VG_(threads)[tid].os_state.fatalsig = sigNo;
}
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h Wed Oct 5 06:11:23 2016
@@ -51,7 +51,9 @@
If it isn't blocked in a syscall, has no effect on the thread. */
extern void VG_(get_thread_out_of_syscall)(ThreadId tid);
-/* Nuke all threads except tid. */
+/* This causes all threads except tid to forceably exit. They aren't actually
+ dead by the time this returns; you need to call
+ VG_(reap_threads)() to wait for them. */
extern void VG_(nuke_all_threads_except) ( ThreadId me,
VgSchedReturnCode reason );
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am Wed Oct 5 06:11:23 2016
@@ -167,6 +167,7 @@
pth_rwlock.stderr.exp pth_rwlock.vgtest \
pth_stackalign.stderr.exp \
pth_stackalign.stdout.exp pth_stackalign.vgtest \
+ pth_term_signal.stderr.exp pth_term_signal.vgtest \
rcrl.stderr.exp rcrl.stdout.exp rcrl.vgtest \
readline1.stderr.exp readline1.stdout.exp \
readline1.vgtest \
@@ -224,7 +225,7 @@
pselect_sigmask_null \
pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
pth_empty pth_exit pth_exit2 pth_mutexspeed pth_once pth_rwlock \
- pth_stackalign \
+ pth_stackalign pth_term_signal\
rcrl readline1 \
require-text-symbol \
res_search resolv \
@@ -315,6 +316,7 @@
pth_rwlock_CFLAGS += --std=c99
endif
pth_stackalign_LDADD = -lpthread
+pth_term_signal_LDADD = -lpthread
res_search_LDADD = -lresolv -lpthread
resolv_CFLAGS = $(AM_CFLAGS)
resolv_LDADD = -lresolv -lpthread
|