From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4656 Path: news.gmane.org!not-for-mail From: John Spencer Newsgroups: gmane.linux.lib.musl.general Subject: Re: Static linking of musl with code compiled using GNU header files Date: Fri, 14 Mar 2014 22:37:08 +0100 Message-ID: <53237684.1070006@barfooze.de> References: <53232493.80901@gcom.com> <20140314162957.GB27448@port70.net> <53234FE2.7040309@gcom.com> <53236EF2.4030606@gcom.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1394833056 26062 80.91.229.3 (14 Mar 2014 21:37:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Mar 2014 21:37:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4660-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 14 22:37:46 2014 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 1WOZnV-0005Iy-5R for gllmg-musl@plane.gmane.org; Fri, 14 Mar 2014 22:37:45 +0100 Original-Received: (qmail 23597 invoked by uid 550); 14 Mar 2014 21:37:44 -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 23589 invoked from network); 14 Mar 2014 21:37:44 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <53236EF2.4030606@gcom.com> Xref: news.gmane.org gmane.linux.lib.musl.general:4656 Archived-At: David Grothe wrote: > I built a shim module that defined all the undefined "__" routines that > showed up in my link. Then all my programs linked successfully. But > when I went to run one of my daemon processes it got a segv in the > malloc code, as follows. on which platform is this ? the linaro bit in your toolchain suggests that it is ARM. is that correct ? and which version of musl ? limited ABI compat is only there for x86 platforms. as for your problem below, it's possible that something else calls sbrk() messing up musl's allocator. you should check strace output to see if sbrk(0) is called more than once. also make sure that nothing pulls in glibc's libc.so. btw did you check your code against the ABI checklist that was pointed out earlier ? to me, it's not very surprising that your broken usage breaks and invokes UB somewhere.. > > Program terminated with signal 11, Segmentation fault. > #0 0x0811cd5d in unbin (c=0x9b53898, i=8) at src/malloc/malloc.c:242 > #1 0x0811d266 in malloc (n=112) at src/malloc/malloc.c:371 > #2 0x0804b3ce in ssd_malloc_fcn (nbytes=16, file=0x81348e6 "../pi.c", > linenr=2398) at ../pi.c:632 > #3 0x0804b597 in ssd_zalloc_fcn (nbytes=12, file=0x81348e6 "../pi.c", > linenr=2398) at ../pi.c:687 > #4 0x0804b5e2 in ssd_calloc_fcn (n_memb=1, memb_size=12, file=0x81348e6