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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to