Author: vangyzen
Date: Fri May 26 15:51:51 2017
New Revision: 318952
URL: https://svnweb.freebsd.org/changeset/base/318952

Log:
  libthr: prevent setcontext() from masking SIGTHR
  
  __thr_setcontext() mistakenly tested for the presence of SIGCANCEL
  in its local ucontext_t instead of the parameter. Therefore,
  if a thread calls setcontext() with a context whose signal mask
  contains SIGTHR (a.k.a. SIGCANCEL), that signal will be blocked,
  preventing the thread from being cancelled or suspended.
  
  Reported by:  gcc 6.1 via RISC-V tinderbox
  Reviewed by:  kib
  MFC after:    3 days
  Sponsored by: Dell EMC
  Differential Revision:        https://reviews.freebsd.org/D10933

Modified:
  head/lib/libthr/thread/thr_sig.c

Modified: head/lib/libthr/thread/thr_sig.c
==============================================================================
--- head/lib/libthr/thread/thr_sig.c    Fri May 26 15:49:20 2017        
(r318951)
+++ head/lib/libthr/thread/thr_sig.c    Fri May 26 15:51:51 2017        
(r318952)
@@ -736,7 +736,7 @@ __thr_setcontext(const ucontext_t *ucp)
                errno = EINVAL;
                return (-1);
        }
-       if (!SIGISMEMBER(uc.uc_sigmask, SIGCANCEL))
+       if (!SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL))
                return __sys_setcontext(ucp);
        (void) memcpy(&uc, ucp, sizeof(uc));
        SIGDELSET(uc.uc_sigmask, SIGCANCEL);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to