From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8094 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Commit 01d4274 breaks Clang's LeakSanitizer when used with musl Date: Thu, 2 Jul 2015 21:46:34 +0200 Message-ID: <20150702194634.GJ32532@port70.net> References: <20150702190037.GJ1173@brightrain.aerifal.cx> <20150702192916.GI32532@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1435866417 21430 80.91.229.3 (2 Jul 2015 19:46:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jul 2015 19:46:57 +0000 (UTC) To: musl@lists.openwall.com, Constantine Original-X-From: musl-return-8107-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 02 21:46:49 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZAkRb-0008RB-Qr for gllmg-musl@m.gmane.org; Thu, 02 Jul 2015 21:46:47 +0200 Original-Received: (qmail 28590 invoked by uid 550); 2 Jul 2015 19:46:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28572 invoked from network); 2 Jul 2015 19:46:46 -0000 Mail-Followup-To: musl@lists.openwall.com, Constantine Content-Disposition: inline In-Reply-To: <20150702192916.GI32532@port70.net> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8094 Archived-At: * Szabolcs Nagy [2015-07-02 21:29:16 +0200]: > * Rich Felker [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 > > > > > > 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.. hm wait a minute, interception was not supposed to work with musl it still uses -Bsymbolic-functions so my analysis cant be correct i dont know why it worked before and why that check fails now