From owner-freebsd-threads@FreeBSD.ORG Fri Feb 6 11:37:40 2015 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99C61967 for ; Fri, 6 Feb 2015 11:37:40 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F463195 for ; Fri, 6 Feb 2015 11:37:40 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t16Bbe4K092611 for ; Fri, 6 Feb 2015 11:37:40 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 197365] pthread_barrier_destroy() return EBUSY on idle barrier Date: Fri, 06 Feb 2015 11:37:40 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 10.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: fguiliani@verisign.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2015 11:37:40 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197365 Bug ID: 197365 Summary: pthread_barrier_destroy() return EBUSY on idle barrier Product: Base System Version: 10.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: threads Assignee: freebsd-threads@FreeBSD.org Reporter: fguiliani@verisign.com Created attachment 152607 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=152607&action=edit reproduce test case pthread_barrier_destroy() can return EBUSY even when the barrier is not in use. The problem was introduced somewhere between FreeBSD 8 and 10.0-RELEASE. I have attached a simple test case to reproduce the issue. The problem seems related to the use of uninitialized memory. pthread_barrier_destroy() is testing bar->b_destroying in thr_barrier.c: https://github.com/verisign/freebsd/blob/f4c11c6b678195515bbab8bb2825fa5222ed3a58/lib/libthr/thread/thr_barrier.c#L53 while pthread_barrier_init() did not initialized bar->b_destroying: https://github.com/verisign/freebsd/blob/f4c11c6b678195515bbab8bb2825fa5222ed3a58/lib/libthr/thread/thr_barrier.c#L95 -- You are receiving this mail because: You are the assignee for the bug. From owner-freebsd-threads@FreeBSD.ORG Fri Feb 6 12:19:08 2015 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6CEF1A6C for ; Fri, 6 Feb 2015 12:19:08 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5406E93C for ; Fri, 6 Feb 2015 12:19:08 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t16CJ8U4056684 for ; Fri, 6 Feb 2015 12:19:08 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 197365] pthread_barrier_destroy() return EBUSY on idle barrier Date: Fri, 06 Feb 2015 12:19:08 +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: 10.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2015 12:19:08 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197365 --- Comment #1 from commit-hook@freebsd.org --- A commit references this bug: Author: kib Date: Fri Feb 6 12:18:39 UTC 2015 New revision: 278313 URL: https://svnweb.freebsd.org/changeset/base/278313 Log: Fully initialize allocated memory for the new barrier. The b_destroying member was left uninitialized, which caused spurious EBUSY. PR: 197365 Noted by: Florent Guiliani Sponsored by: The FreeBSD Foundation MFC after: 1 week Changes: head/lib/libthr/thread/thr_barrier.c -- You are receiving this mail because: You are the assignee for the bug. From owner-freebsd-threads@FreeBSD.ORG Fri Feb 6 13:25:28 2015 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C5047F0 for ; Fri, 6 Feb 2015 13:25:28 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7307810F for ; Fri, 6 Feb 2015 13:25:28 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t16DPSRE023310 for ; Fri, 6 Feb 2015 13:25:28 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 197365] pthread_barrier_destroy() return EBUSY on idle barrier Date: Fri, 06 Feb 2015 13:25:28 +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: 10.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: fguiliani@verisign.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2015 13:25:28 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197365 --- Comment #2 from Florent Guiliani --- Thank you for the fix. I was about to post a patch but you were faster than me. -- You are receiving this mail because: You are the assignee for the bug.