Date: Sat, 30 Nov 2013 14:36:32 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r258766 - stable/10/lib/libthr/thread Message-ID: <201311301436.rAUEaWOD076107@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Nov 30 14:36:32 2013 New Revision: 258766 URL: http://svnweb.freebsd.org/changeset/base/258766 Log: MFC r258499: Fix for the spurious signal handler call with zero signo in the threaded process. Approved by: re (hrs) Modified: stable/10/lib/libthr/thread/thr_private.h stable/10/lib/libthr/thread/thr_sig.c Directory Properties: stable/10/lib/libthr/ (props changed) Modified: stable/10/lib/libthr/thread/thr_private.h ============================================================================== --- stable/10/lib/libthr/thread/thr_private.h Sat Nov 30 12:51:19 2013 (r258765) +++ stable/10/lib/libthr/thread/thr_private.h Sat Nov 30 14:36:32 2013 (r258766) @@ -433,6 +433,9 @@ struct pthread { /* the sigaction should be used for deferred signal. */ struct sigaction deferred_sigact; + /* deferred signal delivery is performed, do not reenter. */ + int deferred_run; + /* Force new thread to exit. */ int force_exit; Modified: stable/10/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/10/lib/libthr/thread/thr_sig.c Sat Nov 30 12:51:19 2013 (r258765) +++ stable/10/lib/libthr/thread/thr_sig.c Sat Nov 30 14:36:32 2013 (r258766) @@ -162,6 +162,7 @@ thr_sighandler(int sig, siginfo_t *info, act = _thr_sigact[sig-1].sigact; _thr_rwl_unlock(&_thr_sigact[sig-1].lock); errno = err; + curthread->deferred_run = 0; /* * if a thread is in critical region, for example it holds low level locks, @@ -320,14 +321,18 @@ check_deferred_signal(struct pthread *cu siginfo_t info; int uc_len; - if (__predict_true(curthread->deferred_siginfo.si_signo == 0)) + if (__predict_true(curthread->deferred_siginfo.si_signo == 0 || + curthread->deferred_run)) return; + curthread->deferred_run = 1; uc_len = __getcontextx_size(); uc = alloca(uc_len); getcontext(uc); - if (curthread->deferred_siginfo.si_signo == 0) + if (curthread->deferred_siginfo.si_signo == 0) { + curthread->deferred_run = 0; return; + } __fillcontextx2((char *)uc); act = curthread->deferred_sigact; uc->uc_sigmask = curthread->deferred_sigmask;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311301436.rAUEaWOD076107>