git: 16787d049ece - stable/12 - issignal(): when handling STOP-like signals, drop sigacts mutex earlier.

Konstantin Belousov kib at FreeBSD.org
Sun Jan 17 05:10:47 UTC 2021


The branch stable/12 has been updated by kib:

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

commit 16787d049ece7fdf457e7571050e837fc24a697f
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2020-12-31 01:45:12 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-01-17 04:46:19 +0000

    issignal(): when handling STOP-like signals, drop sigacts mutex earlier.
    
    (cherry picked from commit e0d83cd3e49f0b9e16bc82ced7bd3b0ef9aa6a71)
---
 sys/kern/kern_sig.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index b84793285d8a..9fbb6d86457a 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2950,17 +2950,20 @@ issignal(struct thread *td)
 			 * should ignore tty stops.
 			 */
 			if (prop & SIGPROP_STOP) {
+				mtx_unlock(&ps->ps_mtx);
 				if ((p->p_flag & (P_TRACED | P_WEXIT |
 				    P_SINGLE_EXIT)) != 0 ||
 				    (p->p_pgrp->pg_jobc == 0 &&
-				    (prop & SIGPROP_TTYSTOP) != 0))
+				    (prop & SIGPROP_TTYSTOP) != 0)) {
+					mtx_lock(&ps->ps_mtx);
 					break;	/* == ignore */
+				}
 				if (TD_SBDRY_INTR(td)) {
 					KASSERT((td->td_flags & TDF_SBDRY) != 0,
 					    ("lost TDF_SBDRY"));
+					mtx_lock(&ps->ps_mtx);
 					return (-1);
 				}
-				mtx_unlock(&ps->ps_mtx);
 				WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK,
 				    &p->p_mtx.lock_object, "Catching SIGSTOP");
 				sigqueue_delete(&td->td_sigqueue, sig);


More information about the dev-commits-src-branches mailing list