Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2017 15:51:51 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318952 - head/lib/libthr/thread
Message-ID:  <201705261551.v4QFppcf085870@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705261551.v4QFppcf085870>