From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11635 Path: news.gmane.org!.POSTED!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [RFC PATCH] Allow annotating calloc for Valgrind Date: Sun, 2 Jul 2017 16:55:08 +0300 (MSK) Message-ID: References: <20170629225614.19061-1-amonakov@ispras.ru> <20170629232032.GH1627@brightrain.aerifal.cx> <20170629235624.GI1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1499003728 14985 195.159.176.226 (2 Jul 2017 13:55:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Jul 2017 13:55:28 +0000 (UTC) User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) To: musl@lists.openwall.com Original-X-From: musl-return-11648-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 02 15:55:25 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dRfLO-0003X3-FO for gllmg-musl@m.gmane.org; Sun, 02 Jul 2017 15:55:22 +0200 Original-Received: (qmail 15429 invoked by uid 550); 2 Jul 2017 13:55:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15408 invoked from network); 2 Jul 2017 13:55:23 -0000 In-Reply-To: <20170629235624.GI1627@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:11635 Archived-At: On Thu, 29 Jun 2017, Rich Felker wrote: > It reached the point of an faq item on irc; perhaps it was never > discussed on the ml. I feel a quick reminder of what was discussed would be very nice. > If that happens, it's just a valgrind bug. It can see the memory was > returned by calloc and therefore the contents are defined. But maybe > before discussing this further we need to clarify what the actual > scenario is. Alright. As far as I can tell, everyone hits this (only) with static linking. Valgrind core *does* have a concept of a symbol table being distinct from dynamic symbol table (info from symtab is successfully used for backtracing for example), so in principle Memcheck could use just the .symtab when running unstripped static executables. Unfortunately, historically the implementation of Memcheck relies entirely on dynamic linking to intercept allocation functions. As a result, Memcheck's functionality on static executables degrades significantly (it can still find a subset of uninit access errors). I guess the proper fix - wiring up .symtab-based interception - might require more time than anyone was prepared to volunteer. I think at the moment client requests are the only straightforward way to use Memcheck fully with statically-linked programs. But for full functionality, people would need extra requests informing Memcheck about the effects of static malloc & free. Where would such a patch belong? Alexander