Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2021 01:14:54 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: 2b348ecde121 - stable/13 - ptracestop: mark threads suspended there with the new TDB_SSWITCH flag
Message-ID:  <202105100114.14A1EsRY028734@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=2b348ecde121f57020addd77d59a1b79b8046c79

commit 2b348ecde121f57020addd77d59a1b79b8046c79
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-04-24 12:02:40 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-05-10 01:03:00 +0000

    ptracestop: mark threads suspended there with the new TDB_SSWITCH flag
    
    (cherry picked from commit 68d311b66678d9daffc5cf1c78f3101f2eeec3ea)
---
 sys/kern/kern_sig.c | 2 ++
 sys/sys/proc.h      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 46b520030dcd..445582a176c8 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2648,7 +2648,9 @@ ptracestop(struct thread *td, int sig, ksiginfo_t *si)
 				td->td_dbgflags &= ~TDB_STOPATFORK;
 			}
 stopme:
+			td->td_dbgflags |= TDB_SSWITCH;
 			thread_suspend_switch(td, p);
+			td->td_dbgflags &= ~TDB_SSWITCH;
 			if (p->p_xthread == td)
 				p->p_xthread = NULL;
 			if (!(p->p_flag & P_TRACED))
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 0a779820fddc..e4e01f9bec16 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -484,6 +484,7 @@ do {									\
 #define	TDB_VFORK	0x00000800 /* vfork indicator for ptrace() */
 #define	TDB_FSTP	0x00001000 /* The thread is PT_ATTACH leader */
 #define	TDB_STEP	0x00002000 /* (x86) PSL_T set for PT_STEP */
+#define	TDB_SSWITCH	0x00004000 /* Suspended in ptracestop */
 
 /*
  * "Private" flags kept in td_pflags:



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