The branch stable/13 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b2955191736a73de74f465a23cf2d203102f0bd6

commit b2955191736a73de74f465a23cf2d203102f0bd6
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-05-18 16:25:50 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-06-01 00:38:53 +0000

    sys_process.c: extract ptrace_unsuspend()
    
    (cherry picked from commit d7a7ea5be60753c140a39ec6fa30e5ca4014dbb5)
---
 sys/kern/sys_process.c | 20 ++++++++++++++------
 sys/sys/ptrace.h       |  3 +++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index bc38a8ee585d..2515a9cf1e4f 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -610,6 +610,19 @@ proc_set_traced(struct proc *p, bool stop)
        p->p_ptevents = PTRACE_DEFAULT;
 }
 
+void
+ptrace_unsuspend(struct proc *p)
+{
+       PROC_LOCK_ASSERT(p, MA_OWNED);
+
+       PROC_SLOCK(p);
+       p->p_flag &= ~(P_STOPPED_TRACE | P_STOPPED_SIG | P_WAITED);
+       thread_unsuspend(p);
+       PROC_SUNLOCK(p);
+       itimer_proc_continue(p);
+       kqtimer_proc_continue(p);
+}
+
 static int
 proc_can_ptrace(struct thread *td, struct proc *p)
 {
@@ -1164,12 +1177,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void 
*addr, int data)
                 * suspended, use PT_SUSPEND to suspend it before
                 * continuing the process.
                 */
-               PROC_SLOCK(p);
-               p->p_flag &= ~(P_STOPPED_TRACE | P_STOPPED_SIG | P_WAITED);
-               thread_unsuspend(p);
-               PROC_SUNLOCK(p);
-               itimer_proc_continue(p);
-               kqtimer_proc_continue(p);
+               ptrace_unsuspend(p);
                break;
 
        case PT_WRITE_I:
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index 06f01a04fd9d..1e7c1c71056b 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -240,6 +240,9 @@ int proc_write_fpregs32(struct thread *_td, struct fpreg32 
*_fpreg32);
 int    proc_read_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);
 int    proc_write_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);
 #endif
+
+void   ptrace_unsuspend(struct proc *p);
+
 #else /* !_KERNEL */
 
 #include <sys/cdefs.h>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to