From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 18874385483C for ; Wed, 17 Mar 2021 17:43:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 18874385483C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-hPiSUCaVO76F1EP0l-Bxng-1; Wed, 17 Mar 2021 13:43:27 -0400 X-MC-Unique: hPiSUCaVO76F1EP0l-Bxng-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 406BA107ACCA; Wed, 17 Mar 2021 17:43:26 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-121.ams2.redhat.com [10.36.115.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6660B2B431; Wed, 17 Mar 2021 17:43:25 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3 08/37] nptl: Move pthread_once and __pthread_once into libc References: <3ab7ccc92585d17c3171cf375605b53252d6b9a9.1615914631.git.fweimer@redhat.com> <41a88cab-808e-c10e-a975-41cdd252c299@linaro.org> <5405bbad-3c70-4435-8815-59e84738c3fb@linaro.org> <87h7l93klm.fsf@oldenburg.str.redhat.com> <583d20d2-54fe-9c30-805e-7182e00965bc@linaro.org> <87v99p1zxh.fsf@oldenburg.str.redhat.com> Date: Wed, 17 Mar 2021 18:43:31 +0100 In-Reply-To: (Adhemerval Zanella's message of "Wed, 17 Mar 2021 14:22:46 -0300") Message-ID: <87lfal1xrw.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 17:43:30 -0000 * Adhemerval Zanella: >> nss_ldap would silently link to __pthread_once@@GLIBC_PRIVATE instead >> after a rebuild. That's not a step forward, I think. > > From nss_ldap from where exactly the __pthread_once will be originated? > I would expect that building it against 2.34 headers to reference=20 > pthread_once instead. It's related to the in-process nature of nss_ldap (without the d), LinuxThreads, and pthread_atfork not available in libc at the time: /* * This bogosity is necessary because Linux uses different * PIDs for different threads (like IRIX, which we don't * support). We can tell whether we are linked against * libpthreads by whether __pthread_once is NULL or * not. If it is NULL, then we're not linked with the * threading library, and we need to compare the current * process ID against the saved one to figure out * whether we've forked.=20 * * -- * __pthread_once does not imply __pthread_atfork being non-NULL! * <=E2=80=A6@redhat.com> * -- *=20 * Once we know whether we have forked or not,=20 * courtesy of pthread_atfork() or us checking * ourselves, we can close the socket to the LDAP * server to avoid leaking a socket, and reopen * another connection. Under no circumstances do we * wish to use the same connection, or to send an * unbind PDU over the parents connection, as that * will wreak all sorts of havoc or inefficiencies, * respectively. */ Of course this is all somewhat questionable, but at least there is one historic user of that symbol. I think we should turn this into a compat symbol once we do not need the internal reference (or call it by a different name instead). > Right, does call pthread_once from call_once incur in a linknamespace > issue? Yes, call_once is ISO C, but pthread_once is not a reserved name in ISO C. Thanks, Florian