From nobody Mon Aug 08 21:34:27 2022 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 4M1qGY299hz4YDPr for ; Mon, 8 Aug 2022 21:34:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M1qGX5njyz40L9 for ; Mon, 8 Aug 2022 21:34:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 4M1qGX4W1mz16Rx for ; Mon, 8 Aug 2022 21:34:28 +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 278LYSWr064645 for ; Mon, 8 Aug 2022 21:34:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 278LYSBp064644 for threads@FreeBSD.org; Mon, 8 Aug 2022 21:34:28 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 237195] pthread_mutex_unlock crash as unlocked mutex destroyed by signaled thread Date: Mon, 08 Aug 2022 21:34:27 +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: 12.0-RELEASE X-Bugzilla-Keywords: crash, needs-qa X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: longwitz@incore.de X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: mfc-stable12? mfc-stable11? 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: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659994469; 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=BfEW691hau1qW6pPNq9GMA9y/Vml54Ou7qTI6FpLagw=; b=YU3yMUmIAyhWa0QGBnqzDgShRxZE8aOHz3Cv7+h8oCpoKA1bdo827/G3XlLikQPttOD1Yl r/aE+sIRkadtYDSf2885+ALndIhYEnRYYliahCqw+oNlOReSuz4OcdPkQVvyG8GauR0JRU u5GkoTw3F6rYFuGSjrFu6CipC5n2NvMzQzeEgHRWoelpzu2nWR9VeayW1ogBa07wJ7rez3 4iglwFnmhKBMoIfj2bo3DhVY4TBa6dHR0Ztde6JBOq9S1gTuDh/JYW/qgJ05vThGEZqaey eu4LGPTYSB/OPIzanpNN99CFQ0YiqjGXmntspD8ndDJY8RyDYamEQCt4qOC2Yg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659994469; a=rsa-sha256; cv=none; b=bu3218htZvWFEZ2UclW1y1dli/2chxF7Vo80Kej71iy0nx8GQzJsoOR6fCYJ0PUzzQpiG4 2DNl9DHFCaPO1gbAToUk+YKFD6eIenHfRpHpJ3lt3FPYOYGcv9NkMXu8hHo1mDijxF8wMp JiYUIXyL2T34NufcazZRvFpv6WjZ4HAvoB3cOTdu0L2ad5LwOIKrhOV2RsnKsmOoBezJUA i4u8bFBk1YlpKNtrhO1wNcEaRoyav98ECPlhuPR9nc//5iIBdjKs7VyypP9e7tcc816T/Q S3ysJGtKaKbAphBneVVr/T/jYYWEW3meZuvKiEymNsF4tSfm5q1bkOXrsK7kAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237195 --- Comment #13 from longwitz@incore.de --- OK, thank you for clarification. One bug in my test program was by mistake,= an other for demonstration. With following patch the program works as I have intended: --- mypshared.c.orig 2022-08-06 21:13:03.438699000 +0200 +++ mypshared.c 2022-08-08 10:24:26.021928000 +0200 @@ -34,7 +34,7 @@ pthread_mutexattr_t attr, *attrp =3D NULL; int rc, first, mycounter; -int init_only_on_first =3D 0, always_destroy =3D 1; +int init_only_on_first =3D 0, always_destroy =3D 0; pthread_mutex_t magic, *magicp =3D &magic; @@ -120,7 +120,7 @@ void start_mutex() { - if ( init_only_on_first && first ) { + if( !init_only_on_first || first ) { rc =3D pthread_mutex_init((pthread_mutex_t *)®ionp->mutexp, attrp= ); printf("rc of pthread_mutex_init =3D %d\n", rc); if( rc ) exit( rc ); --=20 You are receiving this mail because: You are the assignee for the bug.=