From owner-freebsd-current@FreeBSD.ORG Mon Mar 23 12:32:23 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B273A85; Mon, 23 Mar 2015 12:32:23 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE54B22A; Mon, 23 Mar 2015 12:32:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t2NCWHrK010459 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 23 Mar 2015 14:32:17 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t2NCWHrK010459 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t2NCWHk0010458; Mon, 23 Mar 2015 14:32:17 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 23 Mar 2015 14:32:17 +0200 From: Konstantin Belousov To: "Ivan A. Kosarev" Subject: Re: Use of chunksize before initialization Message-ID: <20150323123217.GL2379@kib.kiev.ua> References: <550C27D8.2010105@ivan-labs.com> <20150321010218.GD2379@kib.kiev.ua> <550D37DA.7060105@ivan-labs.com> <20150321213106.GV2379@kib.kiev.ua> <550FFE02.5040900@ivan-labs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <550FFE02.5040900@ivan-labs.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-current@freebsd.org, Ed Maste X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2015 12:32:23 -0000 On Mon, Mar 23, 2015 at 01:50:26PM +0200, Ivan A. Kosarev wrote: > > On 03/21/2015 11:31 PM, Konstantin Belousov wrote: > > On Sat, Mar 21, 2015 at 11:20:26AM +0200, Ivan A. Kosarev wrote: > >> On 03/21/2015 03:02 AM, Konstantin Belousov wrote: > >>> On Fri, Mar 20, 2015 at 03:59:52PM +0200, Ivan A. Kosarev wrote: > >>>> #12 0x00000008011b428d in malloc_init_hard () at jemalloc_jemalloc.c:698 > >>>> #13 malloc_init () at jemalloc_jemalloc.c:296 > >>>> #14 0x0000000801243ea2 in ?? () from /lib/libc.so.7 > >>>> #15 0x00000008006a5400 in ?? () > >>>> #16 0x000000080089e5b0 in ?? () from /libexec/ld-elf.so.1 > >>>> #17 0x00007fffffffe0b0 in ?? () > >>>> #18 0x0000000801139d06 in _init () from /lib/libc.so.7 > >>>> #19 0x00007fffffffe0b0 in ?? () > >>> The backtrace is strange. Did you compiled malloc with the debugging > >>> symbols, while keep rest of libc without -g ? > >> I've just added the -g flag to CC_FLAGS in the Makefile and made sure to > >> install an unstripped version of the .so . I could investigate more on > >> why the early calls omit debug symbols, if it does any matter. > > I want to understand at what stage of the initialization the access happens. > > This is why I want to see the complete backtrace. > > It is jemalloc_constructor() that calls malloc_init(), so it should be > called directly by the loader. Do you mean rtld by loader ? Dynamic linker does not explicitely call into libc. The possible situations when such call occurs, is either execution of the initializers, or calls into the libthr-provided rtld locks, where libthr itself calls malloc to allocate the lock's backing store. The appearance of _init on the unparsed stack is indicative, but not conclusive, since gdb shows the nearest dynamic symbol, which could be _init just by chance. I need to know exact sequence of events causing the problem. Or, in other words, I cannot debug by retelling.