svn commit: r318191 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Thu May 11 17:03:46 UTC 2017


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);
 			}


More information about the svn-src-all mailing list