From: Julian Seward Date: Thu, 13 Jun 2002 17:47:05 +0000 (+0000) Subject: Be more robust to the situation where a signal arrives, and there is a X-Git-Tag: svn/VALGRIND_1_0_3~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66492d7e14f2309bfd1d9bcb0477834714e03b15;p=thirdparty%2Fvalgrind.git Be more robust to the situation where a signal arrives, and there is a handler, but in the interval between the signal arriving and it being delivered to the client, the handler is removed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@416 --- diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 7270450e54..cb9d53f92b 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -1099,6 +1099,22 @@ Bool VG_(deliver_signals) ( void ) are delivering the signal in the usual way. And that the client really has a handler for this thread! */ vg_assert(vg_dcss.dcss_sigpending[sigNo]); + + /* A recent addition, so as to stop seriously wierd progs dying + at the following assertion (which this renders redundant, + btw). */ + if (vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_IGN + || vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_DFL) { + /* Strange; perhaps the handler disappeared before we could + deliver the signal. */ + VG_(message)(Vg_DebugMsg, + "discarding signal %d for thread %d because handler missing", + sigNo, tid ); + vg_dcss.dcss_sigpending[sigNo] = False; + vg_dcss.dcss_destthread[sigNo] = VG_INVALID_THREADID; + continue; /* for (sigNo = 1; ...) loop */ + } + vg_assert(vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_IGN && vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_DFL); diff --git a/vg_signals.c b/vg_signals.c index 7270450e54..cb9d53f92b 100644 --- a/vg_signals.c +++ b/vg_signals.c @@ -1099,6 +1099,22 @@ Bool VG_(deliver_signals) ( void ) are delivering the signal in the usual way. And that the client really has a handler for this thread! */ vg_assert(vg_dcss.dcss_sigpending[sigNo]); + + /* A recent addition, so as to stop seriously wierd progs dying + at the following assertion (which this renders redundant, + btw). */ + if (vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_IGN + || vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_DFL) { + /* Strange; perhaps the handler disappeared before we could + deliver the signal. */ + VG_(message)(Vg_DebugMsg, + "discarding signal %d for thread %d because handler missing", + sigNo, tid ); + vg_dcss.dcss_sigpending[sigNo] = False; + vg_dcss.dcss_destthread[sigNo] = VG_INVALID_THREADID; + continue; /* for (sigNo = 1; ...) loop */ + } + vg_assert(vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_IGN && vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_DFL);