From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 453C428E13 for ; Fri, 16 Aug 2024 16:38:55 +0200 (CEST) Received: (qmail 30412 invoked by uid 550); 16 Aug 2024 14:38:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 30360 invoked from network); 16 Aug 2024 14:38:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1723819121; x=1724423921; i=nullplan@gmx.net; bh=0C11f6zJ6IW9y/NLnYN65tYOxquB6Pq0T/ZINj+NLGw=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=TUYKytaRBBYW4M3Bs4U0Lz+n71AMUKlyiI+oXWHHx51d2v6qGML3vDbucmGMK9k0 Ibh+Ws2Agz1XFMyerYeBoS/cpXtxGp5cy/mg9b1MBwrSqkrNeI8uWrpzvriDnVA/3 WOtTdrF1pZ9xWG/vUPptW+mfrmDAEUpIo3ZDnfVTYKiwGKXVsFm9QxwzW7gAS+YCD 8TtH3Qn6D0WPSxcg+AFVKpJHcWBB6gKw+EiQj2/P9exZ2b/EmQ6Tf5QAz3ea0Cu2/ fTQi4fVeA/kYtdLI4a6ertepcOV6fym4pq3LRN8Vfi0W7lj2FxSPPA4Xlc1FEge/2 4LQCNqP4jK/MGJy50Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Date: Fri, 16 Aug 2024 16:38:39 +0200 From: Markus Wichmann To: musl@lists.openwall.com Cc: Zibin Liu Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Provags-ID: V03:K1:4M0eQsZBoyxWkLPndpwrcdgc4g6h7b0TWAfXpJQYKOnEv3RJF/y u3I9rtw9hcR57VE5hwB2PhPL3EwNC5LmWZA7NIXFq/E2GXqJ7aHuQ8jV1ist/i0jqe3FVMs vvkosdX9dwbR49+Qn3M00W0Gu9zuIcVMVZP4ut8xKXkjqmFG7acSacRgesh3mWVE4BAxink bIvJY8rLag220OJEA0jxg== UI-OutboundReport: notjunk:1;M01:P0:iBmaK2X4B8k=;YKEux8zswlkkuB3Z2HZHoztRa9O c1nW1WwkyHnrRNrAh2Qeb0O3YUAogh41baTzMRjpBQhh0ui6hR2vLr2lvaWjRGH7mnS5bkkuN /G2O6TymMx0bP5+ScUMKmmGY3qQSCqec341R+JufhdjitshDBo50bHSh1R000C7TRtjSJaJFP jhTyhsExe58ar+MkZ5I0GuGoS6cccob8EEMCmysLRlSyaxsRdmZvbqU1USNwRNjDpbkWFG0Cl 3XVdzgBJVWPD5SFiZrg8HjzS4p+yFah7LtRs7QTud/cvq5SijhQojlWSUm1jwuJDydtaR4cOE JneTVk6c5SLQCcJs/XYFWtiJJBUYux+9mjcyQn/T0v0MmT6twaBjhaBtFaJ2XLior6e3CQxAT Gu45yQWbBpr626zjHqzweBKvptTFKdiV0ILzsPlzYM4gHGzCQHPjT7XqUg1T2aez0jJmNW6Gn YOq4tZTtM+RZY5kUSOlr71/jCC7tEh678x5zUyeBStCMP9nV6/knm2n3eQFbRPs6jhOaxmHHB FiPEaYNnEJZImguOpt6XnRcEYgICMaKUeWdWe5EB+Nuow+8LMqplJqYGVKRLJpFL+9LW1Dj8h a9Rke26glLDg92/mCiUObq6z3dI2rAg0hnJLhsJrWOlRKf3q934rAPoc/EQ73Q0IGYco6Zir/ rYBEgn98tpPsmtsO47pGVATAQ6VejuMUxBOmG+806Vdbvt2xgz/sCljK7r20SgXa6YNzlfgZ6 T7vJPsLq5u7DapNbBdNXfA+R+FWYwNjg2rvXNMop13ftAUPQLDfm6TfSCI9QYXGpNCJGLR7YP nMwbu+2niU1FQzm7Gs80gsUQ== Subject: Re: [musl] ptc in pthread Am Fri, Aug 16, 2024 at 10:51:53AM +0800 schrieb Zibin Liu: > Despite this, I=E2=80=99m still unclear on why dlopen needs to ensure th= at the > thread count does not increase. Could someone provide more details on > this? This is in case a library is opened that contains TLS. In that case, the thread calling dlopen() must allocate a new TLS block for the library for every thread that currently exists, as well as a new DTV to contain the pointers. If a thread could be created during this, obviously there could be a thread created without that TLS block. musl doesn't use the lazy TLS initialization scheme glibc uses, because that one admits no failure. In that scheme, memory for the new TLS is allocated in __tls_get_addr(), but if allocation fails, there is no choice but to abort. In musl's implementation, the memory is allocated in dlopen(), and if it cannot be allocated, the dlopen() fails. The lock cannot be reduced in scope to the TLS installation, since each library can pull in dependencies that can also have TLS. Ciao, Markus