From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2642 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: dladdr() Date: Mon, 21 Jan 2013 13:35:23 -0500 Message-ID: <20130121183523.GP20323@brightrain.aerifal.cx> References: <1358254713.32505.27@driftwood> <1358261684.3766.10.camel@6-core> <20130115184820.GA20323@brightrain.aerifal.cx> <1358334018.2170.23.camel@6-core> <20130116125119.GA27914@port70.net> <50F6B818.1070807@gmail.com> <20130116164943.GD20323@brightrain.aerifal.cx> <50F6E698.3070604@gmail.com> <20130121020335.GO20323@brightrain.aerifal.cx> <1358751500.2196.20.camel@6-core> 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 1358793343 27086 80.91.229.3 (21 Jan 2013 18:35:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jan 2013 18:35:43 +0000 (UTC) To: musl@lists.openwall.com, pierre@silentlife.com Original-X-From: musl-return-2643-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 21 19:36:01 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TxMDr-00087S-Pk for gllmg-musl@plane.gmane.org; Mon, 21 Jan 2013 19:35:55 +0100 Original-Received: (qmail 26108 invoked by uid 550); 21 Jan 2013 18:35:37 -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 26097 invoked from network); 21 Jan 2013 18:35:37 -0000 Content-Disposition: inline In-Reply-To: <1358751500.2196.20.camel@6-core> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2642 Archived-At: On Mon, Jan 21, 2013 at 07:58:20AM +0100, pierre wrote: > > > is dladdr otherwise working correctly for you now? > > In the simple example I provided, it always works. > I have added loaded modules with conflicting symbols > and dladdr() also works as expected. > > But for my main application (which populates backtraces > with dladdr), musl dladdr() works in DEBUG mode and > crashes in RELEASE mode. I did not have time to isolate > the problem in a reproducible code snippet but I will > let you know when I have done that. The only non-static memory access dladdr makes are: 1. Reading the map ranges for each loaded DSO from the DSO list. 2. Reading the hash table pointers for the matching DSO (if one was found), and: 2a. If there's a sysv hash table, just reading the number of symbols directly from it. 2b. If there's only a gnu hash table, reading the gnu hash table and counting the number of symbols. 3. Reading the locations of the symbol and string tables from the DSO record. 4. Reading each symbol table entry to find the best match for the argument. 5. Storing results to the caller-provided Dl_info buffer. I don't see how any of these could crash without memory already having been corrupted. Do you have a test case I could run, or have you tried building libc with -g and examining the crash in gdb to see where it happens? Rich