From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6809 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl built with pcc yields segfaults in dynlink.c Date: Tue, 6 Jan 2015 18:01:10 -0800 Message-ID: <20150107020107.GA2336@newbook> References: <20150106074849.GA25889@newbook> <20150106204924.GM4574@brightrain.aerifal.cx> <20150106225647.GA2194@newbook> <20150107005357.GN4574@brightrain.aerifal.cx> 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 1420596110 21061 80.91.229.3 (7 Jan 2015 02:01:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2015 02:01:50 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6822-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 07 03:01:46 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 1Y8fvz-0000eO-VP for gllmg-musl@m.gmane.org; Wed, 07 Jan 2015 03:01:20 +0100 Original-Received: (qmail 6026 invoked by uid 550); 7 Jan 2015 02:01:18 -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 6018 invoked from network); 7 Jan 2015 02:01:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=nU3VTtsR8glt00lWjzvmCvzHtRABsvnk5+NaEwTTNVY=; b=xqaAIiAn9cFxq6rgnmf9IpNNBwq32Gyx5QHCS5gBRSpOKu0dMANBcOC3HXk9FQaeIZ pk1UHqlFBtjMWu/wlspwA3BJyaBt5Ui/qJI3FY3/7lfrL8bYIMkh13atb8RYezqOZPEu RQAa6EtEUcGXafNQ+dwoJn7BL3p+FeKlp4GZb4qyr0wdjHX8KbXA2z6qt1UvWHM5z5m2 QedOkiYPvNFFGldYxDIPO8JztW++TxB5TgqjUUf4iAlL/Gn+Ksit2KMPMON21MyzorKV zFp2Iw++L6WMoS7+O1rF9QGGo+5vCf2E27CNz+0zzYt1cMGGQMBSPfiP3zrouyHChv+f TGzQ== X-Received: by 10.68.241.35 with SMTP id wf3mr928944pbc.22.1420596066166; Tue, 06 Jan 2015 18:01:06 -0800 (PST) Content-Disposition: inline In-Reply-To: <20150107005357.GN4574@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:6809 Archived-At: On Tue, Jan 06, 2015 at 07:53:57PM -0500, Rich Felker wrote: > On Tue, Jan 06, 2015 at 02:56:50PM -0800, Isaac Dunham wrote: > > On Tue, Jan 06, 2015 at 03:49:24PM -0500, Rich Felker wrote: > > > On Mon, Jan 05, 2015 at 11:48:50PM -0800, Isaac Dunham wrote: > > > > Hello, > > > > I'm trying to get a pcc-built libc.so that works. > > > > With the latest PCC, musl builds (lib/libc.so) and the result will display > > > > the proper messages if run from the command line without arguments. > > > > However, if I try to run a program with it > > > > (even via -Wl,-dynamic-linker,`pwd`/lib/libc.so), I get a segfault > > > > in src/ldso/dynlink.c: > > > > (gdb) where > > > > #0 sysv_hash (s0=0x0, s0=0x0) at src/ldso/dynlink.c:177 > > > > #1 0xb7f6f747 in find_sym (dso=0xbffffb18, rel=0xb7ffe1d4 <.L1502>, > > > > rel_size=, stride=, dso=0xbffffb18, > > > > rel=0xb7ffe1d4 <.L1502>, rel_size=, stride=) > > > > at src/ldso/dynlink.c:251 > > > > #2 0xb7f6f916 in do_relocs () at src/ldso/dynlink.c:308 > > > > Backtrace stopped: frame did not save the PC > > > > > > > > I'm using Alpine Linux edge, recently updated, with linux-vanilla. > > > > > > It would be helpful to see the readelf -a output for libc.so and the > > > binary using it, and whatever information gdb can give on the value of > > > local vars at each of the above call frames. > > > > Attaching a tar.xz containing the output of: > > - readelf -a lib/libc.so: libc-pcc.readelf > > - readelf -a a.out: argvname.readelf > > - echo -e 'run\nwhere\nbt full' |gdb ./a.out: argvname.gdb > > (which is substantially similar to the output for "lib/libc.so ./a.out") > > - and the source for a.out: argvname.c > > > > It's 51k, so I'm hoping it gets through. > > It came through fine, but I suspect the debug info is bogus. The > values being shown don't seem to make sense. It might help more to > show the disassembly at eip and the value of all registers, or to post > the binaries somewhere I could download and analyze them. I looked at > the readelf outputs and didn't see any invalid relocs immediately, so > I'm not sure what's happening. https://www.dropbox.com/s/gfakdgdg4i1n85j/libc.tar.xz?dl=1 As far as I can tell, there's no reason to use the particular program I'm testing with; it just happens to be a trivial program I had. Thanks, Isaac Dunham