git: 9f78c837d94f - main - check_cancel: when in_sigsuspend, send SIGCANCEL unconditionally
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Dec 2024 17:20:27 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f78c837d94f73f1485e2ce012a8e64197dae9d5 commit 9f78c837d94f73f1485e2ce012a8e64197dae9d5 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-12-24 00:08:17 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-12-28 17:01:58 +0000 check_cancel: when in_sigsuspend, send SIGCANCEL unconditionally not only when check_cancel is called from the signal handler. _thr_wake() is not enough to get the sigsuspend(2) syscall out of the loop, since it only terminates sleep when an unblocked signal is delivered. PR: 283101 In collaboration with: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48200 --- lib/libthr/thread/thr_sig.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index e69641d8e1b5..c5ee5aa8423b 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -353,9 +353,11 @@ check_cancel(struct pthread *curthread, ucontext_t *ucp) * on getting a signal before it agrees to return. */ if (curthread->cancel_point) { - if (curthread->in_sigsuspend && ucp != NULL) { - SIGADDSET(ucp->uc_sigmask, SIGCANCEL); - curthread->unblock_sigcancel = 1; + if (curthread->in_sigsuspend) { + if (ucp != NULL) { + SIGADDSET(ucp->uc_sigmask, SIGCANCEL); + curthread->unblock_sigcancel = 1; + } _thr_send_sig(curthread, SIGCANCEL); } else thr_wake(curthread->tid);