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 [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 605A23858D29 for ; Fri, 1 Jan 2021 13:36:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 605A23858D29 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-RQYL7cO0NOWt37xCNxjdRQ-1; Fri, 01 Jan 2021 08:36:43 -0500 X-MC-Unique: RQYL7cO0NOWt37xCNxjdRQ-1 Received: by mail-qt1-f199.google.com with SMTP id z43so12479496qtb.0 for ; Fri, 01 Jan 2021 05:36:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=fuGIJpGuftaPHFqp7Spz2rE8bJn6pcBZv3Jk+0776Ow=; b=TivGBVgyFa7IZD288OyrynLfdh0XXDV4mVqGFZd9gwYLwhXi7q/3qOH77oRMxmppC8 bvRiiLLVyab3MG8wWvfJfNt4ZPRFTcXzAfR7pkupTvGYRUHvv6Sd9c1XFSH2cV9Cft8o 0yUdbdB0Igawcn1TZf/GAGcwiqhdk22NoEc8q6w1yXyBuL/d7Vj8Qs/UZXMUn3frRXGo VZX6d4613HgJ92rBBqhZ1TLyqz1JjKmXWzyaPscgD03oO3TSrcsHI/T+7NOxvn6mYjJr QBoNT4w6+tVhOVofj2cAFmaKXakCDAl3CHVIUNpQ6IjyZr+RBwoyLiLtrOzqsebwZvzB fi2g== X-Gm-Message-State: AOAM532BgccSg2jW1tGyooFIXugajFoueD4IximTWxxHSo5TcD3TGMA7 NHAGRt7kdIKY7lzvCqdsTRbI3CfnXFObX57YxfeCkWoqrckNYhvMHVhi2u7RBQTmmNJtWSwhbeZ b8B778vVVBLCmBw6Rv0As X-Received: by 2002:ac8:7087:: with SMTP id y7mr62842426qto.246.1609508202875; Fri, 01 Jan 2021 05:36:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJHpX9CUavwiyW8hXIZYr2ozvKKT2NdUE33wrAl8IzSXN4TTlxCwWgHDrozz7fIOFluZ9b0A== X-Received: by 2002:ac8:7087:: with SMTP id y7mr62842417qto.246.1609508202701; Fri, 01 Jan 2021 05:36:42 -0800 (PST) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id c20sm31467979qtj.29.2021.01.01.05.36.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Jan 2021 05:36:41 -0800 (PST) Subject: Re: [patch] Make _thread_db_sizeof_pthread public for Sanitizers To: Florian Weimer , Jan Kratochvil via Libc-alpha Cc: Jan Kratochvil References: <20210101100818.GA368024@host1.jankratochvil.net> <87sg7kesl8.fsf@mid.deneb.enyo.de> From: Carlos O'Donell Organization: Red Hat Message-ID: Date: Fri, 1 Jan 2021 08:36:40 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <87sg7kesl8.fsf@mid.deneb.enyo.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, 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: Fri, 01 Jan 2021 13:36:47 -0000 On 1/1/21 7:42 AM, Florian Weimer wrote: > * Jan Kratochvil via Libc-alpha: > >> Sanitizers currently contain ugly list of glibc versions and their >> sizeof(struct pthread). >> https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L276 >> >> This list is not much maintained causing SEGVs of Sanitizers: >> $ echo 'int main(){}'|clang -g -fsanitize=leak -x c++ -;./a.out >> Tracer caught signal 11: addr=0x7f1087f51f40 pc=0x4222c8 sp=0x7f1086effd40 >> ==234624==LeakSanitizer has encountered a fatal error. >> ==234624==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1 >> ==234624==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc) >> >> I would find better if just glibc made the value public, Sanitizers can then >> read it by dlsym(): > > Do you know why the GetTLS function needs to know the size of the > thread descriptor? And why it adds it to the start address of the TLS > area, without subtracting it from the area size? I think this > identifies the wrong memory region as TLS. This also seems like a use case for GLIBC_DEBUG (available via dlsym, with no copy relocs). However, like you, I'd like to know why the size of the descriptor is needed (XY problem). -- Cheers, Carlos.