Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Apr 2024 08:13:38 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a6caa7bc5423 - stable/13 - stop_all_proc(): skip traced or signal-stoped processes
Message-ID:  <202404170813.43H8Dcjm062219@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit a6caa7bc54235cdc1599038fe4164015c2931545
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-04-04 19:24:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-04-17 08:13:17 +0000

    stop_all_proc(): skip traced or signal-stoped processes
    
    (cherry picked from commit 235436d6311ea5ad00edcc1e553012f0736ea86d)
---
 sys/kern/kern_proc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 61c389f0b345..23d2856a3d32 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -3385,7 +3385,8 @@ allproc_loop:
 		LIST_REMOVE(cp, p_list);
 		LIST_INSERT_AFTER(p, cp, p_list);
 		PROC_LOCK(p);
-		if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP)) != 0) {
+		if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP |
+		    P_STOPPED_SIG)) != 0) {
 			PROC_UNLOCK(p);
 			continue;
 		}
@@ -3406,6 +3407,16 @@ allproc_loop:
 			PROC_UNLOCK(p);
 			continue;
 		}
+		if ((p->p_flag & P_TRACED) != 0) {
+			/*
+			 * thread_single() below cannot stop traced p,
+			 * so skip it.  OTOH, we cannot require
+			 * restart because debugger might be either
+			 * already stopped or traced as well.
+			 */
+			PROC_UNLOCK(p);
+			continue;
+		}
 		sx_xunlock(&allproc_lock);
 		_PHOLD(p);
 		r = thread_single(p, SINGLE_ALLPROC);



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