mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Constantine <iamvfx@gmail.com>
Subject: Re: Commit 01d4274 breaks Clang's LeakSanitizer when used with musl
Date: Thu, 2 Jul 2015 21:29:16 +0200	[thread overview]
Message-ID: <20150702192916.GI32532@port70.net> (raw)
In-Reply-To: <20150702190037.GJ1173@brightrain.aerifal.cx>

* Rich Felker <dalias@libc.org> [2015-07-02 15:00:37 -0400]:
> On Thu, Jul 02, 2015 at 09:22:28PM +0300, Constantine wrote:
> > See this commit in cgit:
> > 
> > http://git.musl-libc.org/cgit/musl/commit/?id=01d4274
> > 
> > "make dlerror state and message thread-local and dynamically-allocated"
> > 
> > 
> > With this commit any application compiled with lsan yelds this error which
> > stops the application from running:
> > 
> > ==15531==Sanitizer CHECK failed:
> > > /mnt/space/llvm/projects/compiler-rt/lib/lsan/lsan_interceptors.cc:58
> > > ((!lsan_init_is_running)) != (0) (0, 0)
> > 
> > 
> > But if I revert 01d4274
> > <https://github.com/procedural/musl-patches/blob/d9fab50/revert_01d4274.patch>
> > on musl 1.1.9 or higher versions, the error goes away and lsan works as
> > expected.
> > 
> > Just letting you guys know that this commit breaks external tools like lsan.
> 
> This happens for all programs, even when there are no dlopen/dlsym
> errors? That seems really odd, since the changed code should be
> unreachable in the absence of such errors. Does the error happen at
> start, at exit, or some other time while the program is running?
> 
> Whatever the cause is, I'm pretty sure it's on the lsan side, and not
> musl's fault. But it would be nice to get some more information so we
> can check and maybe send a useful report to lsan for fixing whatever
> is broken.
> 

i think the cause is that they intercept all allocation functions
and if the act of interception calls into the intercepted function
itself then they have a problem

this happens on glibc with calloc and i think on musl with free
(at least that line is the interceptor for free and they do enough
shady things in their free wrapper to cause a libc internal free call)

of course all this is completely broken and not fixable on the musl side..

for glibc calloc they have some ugly workaround, maybe similar hack
is needed for free in musl, but none of this is future proof so
they will just keep piling hacks..



  reply	other threads:[~2015-07-02 19:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 18:22 Constantine
2015-07-02 19:00 ` Rich Felker
2015-07-02 19:29   ` Szabolcs Nagy [this message]
2015-07-02 19:45     ` Constantine
2015-07-02 21:10       ` Szabolcs Nagy
2015-07-02 19:46     ` Szabolcs Nagy
2015-07-02 19:57     ` Alexander Monakov
2015-07-02 20:20       ` Rich Felker
2015-07-02 22:11         ` Alexander Monakov

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=20150702192916.GI32532@port70.net \
    --to=nsz@port70.net \
    --cc=iamvfx@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).