summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-10-22 11:54:06 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-10-22 11:54:06 +0000
commit5b35c9fbe68e11041130d9e75b8de64c8dd7b10d (patch)
tree90104d228335b8346513333c0d4be3ab8173283b /sys/kern/kern_sig.c
parent591ef9867a45fb65abc32e58212a898514120d2d (diff)
Protect the ps_pgrp pointer by either the KERNEL_LOCK or the ps_mtx.
This should be enough to be on the safe side when unlocking ptsignal where a pr->ps_pgrp->pg_jobc == 0 check happens. OK mpi@ kettenis@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 98edd7378d5..6d3800ccdb0 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.343 2024/10/17 09:11:35 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.344 2024/10/22 11:54:04 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1436,10 +1436,14 @@ cursig(struct proc *p, struct sigctx *sctx, int deep)
* process group, ignore tty stop signals.
*/
if (prop & SA_STOP) {
+ mtx_enter(&pr->ps_mtx);
if (pr->ps_flags & PS_TRACED ||
(pr->ps_pgrp->pg_jobc == 0 &&
- prop & SA_TTYSTOP))
+ prop & SA_TTYSTOP)) {
+ mtx_leave(&pr->ps_mtx);
break; /* == ignore */
+ }
+ mtx_leave(&pr->ps_mtx);
pr->ps_xsig = signum;
SCHED_LOCK();
proc_stop(p, 1);