public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: Florian Weimer <fw@deneb.enyo.de>,
	Jan Kratochvil via Libc-alpha <libc-alpha@sourceware.org>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch] Make _thread_db_sizeof_pthread public for Sanitizers
Date: Fri, 1 Jan 2021 08:36:40 -0500	[thread overview]
Message-ID: <a3c384de-f957-18af-25cc-12bd0da5dc1c@redhat.com> (raw)
In-Reply-To: <87sg7kesl8.fsf@mid.deneb.enyo.de>

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.


  reply	other threads:[~2021-01-01 13:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 10:08 Jan Kratochvil
2021-01-01 12:42 ` Florian Weimer
2021-01-01 13:36   ` Carlos O'Donell [this message]
2021-01-02  8:24   ` Jan Kratochvil
2021-03-05 12:54 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3c384de-f957-18af-25cc-12bd0da5dc1c@redhat.com \
    --to=carlos@redhat.com \
    --cc=fw@deneb.enyo.de \
    --cc=jan.kratochvil@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).