git: 54747740ccc6 - stable/13 - sigtd(): prefer non-stopped thread as a target for signal queue
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Aug 2023 00:59:51 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=54747740ccc6a717c54f23324639bedff5f64211 commit 54747740ccc6a717c54f23324639bedff5f64211 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-07-21 09:41:39 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-07 00:48:45 +0000 sigtd(): prefer non-stopped thread as a target for signal queue (cherry picked from commit dfe172484d0e1de0bb32bcab8775eb83e15031c0) --- sys/kern/kern_sig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 77f63252454a..e002d7d0e5fa 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2100,14 +2100,18 @@ sigtd(struct proc *p, int sig, bool fast_sigblock) if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig) && (!fast_sigblock || curthread->td_sigblock_val == 0)) return (curthread); + + /* Find a non-stopped thread that does not mask the signal. */ signal_td = NULL; FOREACH_THREAD_IN_PROC(p, td) { if (!SIGISMEMBER(td->td_sigmask, sig) && (!fast_sigblock || - td != curthread || td->td_sigblock_val == 0)) { + td != curthread || td->td_sigblock_val == 0) && + (td->td_flags & TDF_BOUNDARY) == 0) { signal_td = td; break; } } + /* Select random (first) thread if no better match was found. */ if (signal_td == NULL) signal_td = FIRST_THREAD_IN_PROC(p); return (signal_td);