Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2017 21:22:33 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325778 - head/sys/kern
Message-ID:  <201711132122.vADLMXeE048867@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Nov 13 21:22:33 2017
New Revision: 325778
URL: https://svnweb.freebsd.org/changeset/base/325778

Log:
  Move loop to clear TDB_SUSPEND into PT_DETACH case.
  
  The PT_DETACH case above the sendsig: label already looped over all
  threads clearing flags in td_dbgflags.  Reuse this loop to clear
  TDB_SUSPEND and move the logic out of the sendsig: block.

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Mon Nov 13 21:09:08 2017	(r325777)
+++ head/sys/kern/sys_process.c	Mon Nov 13 21:22:33 2017	(r325778)
@@ -1128,8 +1128,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
 					sigqueue_delete(&td3->td_sigqueue,
 					    SIGSTOP);
 				}
-				td3->td_dbgflags &= ~(TDB_XSIG | TDB_FSTP);
+				td3->td_dbgflags &= ~(TDB_XSIG | TDB_FSTP |
+				    TDB_SUSPEND);
 			}
+
 			if ((p->p_flag2 & P2_PTRACE_FSTP) != 0) {
 				sigqueue_delete(&p->p_sigqueue, SIGSTOP);
 				p->p_flag2 &= ~P2_PTRACE_FSTP;
@@ -1169,11 +1171,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
 		 */
 		if (data == SIGKILL)
 			p->p_flag |= P_WKILLED;
-
-		if (req == PT_DETACH) {
-			FOREACH_THREAD_IN_PROC(p, td3)
-			    td3->td_dbgflags &= ~TDB_SUSPEND;
-		}
 
 		/*
 		 * Unsuspend all threads.  To leave a thread



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