From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 83E4A3858401; Sun, 12 Sep 2021 01:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83E4A3858401 From: "nsz at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/19329] dl-tls.c assert failure at concurrent pthread_create and dlopen Date: Sun, 12 Sep 2021 01:23:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.22 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nsz at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nszabolcs at gmail dot com X-Bugzilla-Target-Milestone: 2.34 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: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 01:23:50 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D19329 --- Comment #38 from Szabolcs Nagy --- (In reply to xujing from comment #35) > (In reply to cvs-commit@gcc.gnu.org from comment #31) > > commit 1387ad6225c2222f027790e3f460e31aa5dd2c54 > > Author: Szabolcs Nagy > > Date: Wed Dec 30 19:19:37 2020 +0000 > >=20 > > elf: Fix data races in pthread_create and TLS access [BZ #19329] > >=20=20=20=20=20 > this patch use dl_load_lock in _dl_allocate_tls_init, is there a problem > when dlopen a dynamic library which will call pthread_create? I think it > will cause dl_load_lock and dl_load_lock dead lock. the real bug is that ctors are run with the dlopen lock held. that can causes deadlocks anyway (a ctor can create threads and that thread can call dlopen). this is bug 15686 which is not easy to fix, but that's the right solution. (in general, running user callbacks while libc internal locks are held is wrong.) that bug is now more exposed because the lock is also taken at _dl_allocate_tls_init during thread creation. however i expect that to be called in the parent thread only, so there should be no deadlock when ctor calls pthread_create, only when the child thread calls it again (which i considered rare). if you have example code that you think should work but now deadlocks, then please report it. --=20 You are receiving this mail because: You are on the CC list for the bug.=