From nobody Sat Dec 28 17:20:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YL8JW3WhGz5jfXk; Sat, 28 Dec 2024 17:20:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YL8JW1xf4z4mVS; Sat, 28 Dec 2024 17:20:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735406427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RytXOS2a+VTKl8I4065F/DyohB7yxgIjXHvpYeZ8KSw=; b=aRoKQeZQtWVweO7cCcRMb1+4mOyQY2FxF9CLdbikLO3PpSpMFCrQLQ1Zutz7rjW8WlyozA 0WguM7TuwfBDuVZdp7jsVOohLpmln4zKlE0V3ioyY7cqd66AxC0bGdjQaD72mTmLk+kbY4 w4+RJVtyK5/3vNoJwjOtO73nGNgBhqmNgj/jXTEk5nMXTk3QR889/3yQVyWmBcFkmHPwSM Er9AGXayXzT6qIEgPSYI8AYSmBPUMTGn6ARini5kQAQcKFUlS6D/03pNZPlWBsrPpgZZJt b8B9419vRCt6CZj2JxxNDhnYbEvTjKFLDJqbJnKlhdSDAksp7DgHPqv/XoJhTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735406427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RytXOS2a+VTKl8I4065F/DyohB7yxgIjXHvpYeZ8KSw=; b=SxXPRxo9mpVj5XQx3+1ohn2aUCFqR4o6U05zqN5VVXd32pmeg81ykW3ZFe/wGFjdBYFJ+U Teh7U8IEKW9X5C05dwsrZZm+NkJL6PrrILutJQK/twXyMiRUrL7Hu7Ws3NAgPd9298jvRd sq0ObC804ZzFeXlyfgsGp00qWbrrkqW9vE96G8otlIRfNv/AM3Y4ZbxojEyZ4QMjIr4Pa4 /Sf5sBvZZC7ThidJwhd7OoAH7qkrEW7FO1TrmvDWeKzTvvL2wzkV5Awa623SaWvBbYgtcv Gd7hFYbSYayVAUY5Al+h6Tk72tlsr936Qs9SG6efrSUAC/8s21Hui5XerqhPjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735406427; a=rsa-sha256; cv=none; b=U97W2z7WVS9X2bU9fb85X5BjBzvb7HszmR6MlSViJ9MvlzTLnhKBikbnndhMePxFN7F1IB ZNHfEyoDWgbChMhSl0jgSUTjStx4EqVQBizvjRKiGGI3ueopsX28Ubz+y7uNQRWbZYAavB OtuZOyU9hz7bb4REhvJStE9DAIKOmA8ypzWq27nTUqhvrnFbW2XwbwCXwfpxNn0U4205KP Sgu+F4d1A/LNMyjITZBDkXemxP0JcerQvmfVNuMUWVC02cr6J1ONSCFCubpzV83VmE1mXK nDmxgO7VQtrWTnr7z6U32l88Adqa17cRZgvDWozjV1MhH8u+6XOL4ef6KBucZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YL8JW0gtHzYhB; Sat, 28 Dec 2024 17:20:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BSHKR3x062088; Sat, 28 Dec 2024 17:20:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BSHKRRF062085; Sat, 28 Dec 2024 17:20:27 GMT (envelope-from git) Date: Sat, 28 Dec 2024 17:20:27 GMT Message-Id: <202412281720.4BSHKRRF062085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9f78c837d94f - main - check_cancel: when in_sigsuspend, send SIGCANCEL unconditionally List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f78c837d94f73f1485e2ce012a8e64197dae9d5 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f78c837d94f73f1485e2ce012a8e64197dae9d5 commit 9f78c837d94f73f1485e2ce012a8e64197dae9d5 Author: Konstantin Belousov AuthorDate: 2024-12-24 00:08:17 +0000 Commit: Konstantin Belousov 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);