From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by sourceware.org (Postfix) with ESMTPS id 39A5D385781B for ; Sat, 3 Apr 2021 09:14:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 39A5D385781B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=fw@deneb.enyo.de Received: from [172.17.203.2] (port=33953 helo=deneb.enyo.de) by albireo.enyo.de ([172.17.140.2]) with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1lScMB-0000lI-9C; Sat, 03 Apr 2021 09:14:15 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1lScMB-00054W-5c; Sat, 03 Apr 2021 11:14:15 +0200 From: Florian Weimer To: Fangrui Song Cc: libc-alpha@sourceware.org Subject: Re: dlpi_tls_data is incorrect NULL when dlpi_tls_modid>0 References: Date: Sat, 03 Apr 2021 11:14:15 +0200 In-Reply-To: (Fangrui Song's message of "Fri, 2 Apr 2021 16:06:01 -0700") Message-ID: <87a6qf3f2w.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Sat, 03 Apr 2021 09:14:19 -0000 * Fangrui Song: > I was trying to clean up llvm-project/compiler-rt sanitizers GetTls > function https://reviews.llvm.org/D98926 and my change was reverted > due to an annoying Ubuntu 16.04 glibc 2.23 bug (seem so on both amd64 > and ppc64le) > dlpi_tls_data is incorrect NULL when dlpi_tls_modid>0. > > Thread 1 "tls_race.cpp.tm" hit Breakpoint 6, > __sanitizer::CollectStaticTlsRanges (info=0x7fffffffe8d0, size=64, > data=0x7fffffffe9d0) at > /tmp/llvm/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:294 > 294 if (!info->dlpi_tls_data) > (gdb) p *info > $5 = {dlpi_addr = 0, dlpi_name = 0x7ffff7ffe6f8 "", dlpi_phdr = > 0x400040, dlpi_phnum = 10, dlpi_adds = 10, dlpi_subs = 0, > dlpi_tls_modid = 1, dlpi_tls_data = 0x0} > > This works fine on glibc 2.31. How have you verified this on glibc 2.31? As far as I can tell, the TLS block address assignment happens lazily, and dl_iterate_phdr does not trigger it. So it could be the result of different TLS access patterns.