From nobody Sat Dec 21 18:43:20 2024 X-Original-To: threads@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 4YFtTQ36z6z5WtJ8 for ; Sat, 21 Dec 2024 18:43:22 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YFtTQ0bM8z4cRT for ; Sat, 21 Dec 2024 18:43:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734806602; 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: in-reply-to:in-reply-to:references:references; bh=GFOx0MgB4dvcDvQaliP68+ujvBRfbLgLVVM6r6sXoIg=; b=bv8pb+RqohJ9Szv1nIhQMDFv3HI0SwphmfDr8YNtdUkhgBAWWovtr1I6bP3hRlmeVcJ4g+ LzzJG/izzWNTD0IeHSrQKREO0b5Rhrp1CEm+20smAHn2evUUX/cCmCgjGP0cB0JNy+bv4Q q7zWPkbo8iiZ4qkbBQ0t0h5BLc70YyUsrzrqzf4U83F3F9PQLodJZUMu0QNwqXcTbmVK4A lTB1qMS98fmiu5ail7D8CuofSbcW0Wpx8nR1v5uijzuGdE1LT5MCDOH9Az83TlmDjxpwPb WsKMS+ZgBMeBMBTEbg5cXnYeU41lCnYWWZfvKBUrhbKaBm+aPQkS2rpID58JkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734806602; a=rsa-sha256; cv=none; b=RgSoMU900ILCBdY73WCZvQ8ap6qG4plCN51K6a+3Oo66NAUR8QCRFv8A/RFM8XK0Ye25O6 9U3sN1SsirTf0vM2z1Wx1niV3JCiJ/dqGjBIOh1lYI9V+gSEUspQtnXBbBSPrHqplezTj9 YOS9KCxVUbCYiilIiAT1qSP7ly1ka8i48aXjiVJc+MxCNEkIrWQ1QmWMHhkcOLl9pSalfO xDkswqNqNysYt7C3kgKzyFDNHL9Tp6zGYvd40nkOEtu8XWY4CeygOXTMDkgXVLCGvnAo82 ppS7Wtnbl1RM8w88qK7dmnpYAg+dssN4sCVhN4h1wzoT4cElPD6nWbyMqQS+ZQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4YFtTP6gGMzbKC for ; Sat, 21 Dec 2024 18:43:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4BLIhLuV068955 for ; Sat, 21 Dec 2024 18:43:21 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4BLIhL3k068954 for threads@FreeBSD.org; Sat, 21 Dec 2024 18:43:21 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 283101] pthread_cancel() doesn't cancel a thread that's currently in pause() Date: Sat, 21 Dec 2024 18:43:20 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-threads@freebsd.org Sender: owner-freebsd-threads@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283101 --- Comment #19 from Konstantin Belousov --- (In reply to vedad from comment #18) Hm, no, this case is not interesting: there is THR_LOCK() call in the thread exit path, and the debugging patch was too rough to avoid this case. When the victim exiting, the deadlock cannot occur, since we are already past the pause()/sigsuspend() sleep. I slightly improved the detector part of the patch. Also, it is available at https://kib.kiev.ua/git/deviant3.git branch cancel. Lets try again. diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index b953c430158c..a393e51b746a 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -191,8 +191,15 @@ sigcancel_handler(int sig __unused, struct pthread *curthread =3D _get_curthread(); int err; - if (THR_IN_CRITICAL(curthread)) + if (THR_IN_CRITICAL(curthread)) { + if (!curthread->cancelling) { + void *p[1]; +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + p[0] =3D curthread; + abort2("thr_in_critical %p", 1, p); + } return; + } err =3D errno; check_suspend(curthread); check_cancel(curthread, ucp); --=20 You are receiving this mail because: You are the assignee for the bug.=