summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-10-15 13:49:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-10-15 13:49:27 +0000
commit32967a1150760923ad285087fae86e7e2f5d8060 (patch)
tree879e96af998fc8059fa44cea0e8e0e1eeac92d81 /sys/kern/kern_sig.c
parent035545c70eaa2271f0cee296801c46fbe45ebefc (diff)
Indicate that a process has stopped by setting PS_STOPPED flag
The checks in dowait6 and orphanpg using ps_mainproc are flawed and fail if the mainproc called pthread_exit before the other threads. Adding the flag in proc_stop_sweep is racy but the best we have right now. This fixes regress/sys/kern/signal/sig-stop3. OK mpi@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index db6bf45abaf..c0576093843 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.341 2024/10/09 08:58:19 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.342 2024/10/15 13:49:26 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1100,6 +1100,8 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
* Otherwise, process goes back to sleep state.
*/
atomic_setbits_int(&pr->ps_flags, PS_CONTINUED);
+ atomic_clearbits_int(&pr->ps_flags,
+ PS_WAITED | PS_STOPPED);
atomic_clearbits_int(&p->p_flag, P_SUSPSIG);
wakeparent = 1;
if (action == SIG_DFL)
@@ -1512,6 +1514,7 @@ proc_stop_sweep(void *v)
LIST_FOREACH(pr, &allprocess, ps_list) {
if ((pr->ps_flags & PS_STOPPING) == 0)
continue;
+ atomic_setbits_int(&pr->ps_flags, PS_STOPPED);
atomic_clearbits_int(&pr->ps_flags, PS_STOPPING);
if ((pr->ps_pptr->ps_sigacts->ps_sigflags & SAS_NOCLDSTOP) == 0)