Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 May 2017 17:03:45 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318191 - head/sys/kern
Message-ID:  <201705111703.v4BH3jVa035618@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu May 11 17:03:45 2017
New Revision: 318191
URL: https://svnweb.freebsd.org/changeset/base/318191

Log:
  Let ptracestop() suspend threads sleeping in an SBDRY section.
  
  When a thread enters ptracestop(), for example because it had received
  SIGSTOP from ptrace(PT_ATTACH), it attempts to suspend other threads in
  the same process. In the case of a thread sleeping interruptibly in an
  SBDRY section, sig_suspend_threads() must wake the thread and allow it to
  reach the user-mode boundary. However, sig_suspend_threads() would
  erroneously avoid waking up such threads, resulting in an apparent hang.
  
  Reviewed by:	kib
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Thu May 11 16:37:29 2017	(r318190)
+++ head/sys/kern/kern_sig.c	Thu May 11 17:03:45 2017	(r318191)
@@ -2477,6 +2477,7 @@ sig_suspend_threads(struct thread *td, s
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	PROC_SLOCK_ASSERT(p, MA_OWNED);
+	MPASS(sending || td == curthread);
 
 	wakeup_swapper = 0;
 	FOREACH_THREAD_IN_PROC(p, td2) {
@@ -2493,10 +2494,9 @@ sig_suspend_threads(struct thread *td, s
 				 */
 				KASSERT(!TD_IS_SUSPENDED(td2),
 				    ("thread with deferred stops suspended"));
-				if (TD_SBDRY_INTR(td2) && sending) {
+				if (TD_SBDRY_INTR(td2))
 					wakeup_swapper |= sleepq_abort(td2,
 					    TD_SBDRY_ERRNO(td2));
-				}
 			} else if (!TD_IS_SUSPENDED(td2)) {
 				thread_suspend_one(td2);
 			}



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