From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14171 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Markus Wichmann Newsgroups: gmane.linux.lib.musl.general Subject: Re: How to get base address of heap arenas Date: Sun, 2 Jun 2019 21:32:08 +0200 Message-ID: <20190602193208.GA18396@voyager> References: <20190530132723.GT16415@port70.net> <20190530140153.GN23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="213059"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-14187-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 02 21:33:16 2019 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.89) (envelope-from ) id 1hXWEG-000tJv-KY for gllmg-musl@m.gmane.org; Sun, 02 Jun 2019 21:33:16 +0200 Original-Received: (qmail 4029 invoked by uid 550); 2 Jun 2019 19:33:11 -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 4006 invoked from network); 2 Jun 2019 19:33:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559503979; bh=TRlL+GmWwr7aqPVfr5MRpUAsr7cmfr6lDE0XYN1K7OY=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=Ouz0dUj72HXBSm2O5pAbYQVqKl8eprulPSpbVVyhHS0i2ZfyVaHP3ckPSQVmFf2K+ rGGdpeE1qH0U0DdLHS7/Cxga83Z8wLK7xT9COMOml77Kvb/TVczVmTrUIMmrCNFr3k ATaLspNqzPxi0ro1+y6Qdm+a8wSc9khqmnrL2eIU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:TMNF0Et/IQ5IvyXsTHxc90WGTGlvK1R2u4Ux6QjfBPEkdGebat4 Z/mN1vzzhYd4g240z1bz71ukRAowwctqhWkqt9mg2r3JXiEpWfQb/4p/dihTYJihL5Bo25N IrRszlJu6NnMLylEb0vjqyFDYFL2mPZa6w6RfQ3b9vJRgEFsZsPGEr8TPzXlHdmRsLgNlbk ujUGwfrkwrbLAjCGiWpkA== X-UI-Out-Filterresults: notjunk:1;V03:K0:EZ3oaH2xYBs=:Ge4UELclU3wjTcJOp9E+RJ cRexpSH8YVAlOy04JYcgW9fGsx1kExg/C8A5Tm4u8ofRwzEbays2oQdz2X/P7tRwdRH6cZ58b hfj/UId1nL4STdicm2m1mXmfBBNhgoivjqpfRCWljhYJXv8umfCHyW6lUhM3mU5OHz4KSFqk0 7GWOL6XrcR2zJSi3jYcAswY0UOg/U+o0qc/yv4WqH6YexiPGWNSp/hTgPaSCnGJY8DQeIIyLo Djd6wA+xktx7Aqp8i4yiUKuaunDLIl96hwpkL8DavMbK8p6yhleIo+L1ya7A2AaUS5W/K+H5j olFODuhLEp36M9fjAPBd80pFyAOD0dSeg/LDmH+sQWOhUoJUIojSXV6kA2wz+BxaBzixVzH8z oNYKNzhqtqEIjHCmC9+O5gnxi1GOhJ6NOT0cpMBlbLaYlb38g0yRYbCM9sU+B8fzAx7UeiBbA /Tk6S49JgwzYRjFjPin4l+8CEXJHiq4WJt+nWywu7pVcWFKIWNhjkz8CIBn+5UYSHGljio0VW JQ6mXAMH+UqN2yQsYdM/zpIgTM0LJiM6I0M20eATJpky4e7+qijQ4qLaQFuwtM1nE9YHTNc2T tQe8LRh6eOGbldtZl2VeEwwI7PfbTSUa1jvKt12r0YPCnUEOWlrZeIUCIvbCZhIJbvEED2y5J ozSE0Wh6ByOtxrRMCOjgo8y36bPSh4hn4griTaysWTBCRh34u+Udq3wc/7YPexkpY0JrQph5e pt5HYC3QhSfpFILBdbcGwSu4UkrHCogCz/b6kYz45Jcx04XPK4A4kmlMdftDsTCK8iRJ/HQB Xref: news.gmane.org gmane.linux.lib.musl.general:14171 Archived-At: On Thu, May 30, 2019 at 01:49:10PM -0400, sva sva wrote: > Indeed your replies verified my understanding. > > Here's what I want to do: > I have a C library that does malloc interposition and adds signatures to > header and footer of chunks by allocating extra bytes before and after i= t. > It also does a number of other things. Then I have some C code which is > supposed to walk the entire heap to that particular process and spit out > all the heap signatures making sure there are no scribbled ones. > You know, if you just want to debug your dynamic memory, you could just use valgrind, or electric fence. As for your problem, if you are already allocating more memory, why not enqueue all allocated chunks into global lists? This way, the actual heap layout will not matter to you, your analyzer can always find all allocated chunks. Musl's malloc tries to use the brk() heap if it can, but will resort to mmap() if brk() fails for any reason. Therefore the actual chunks may be discontiguous. Searching memory for random numbers does not seem like a good idea. Ciao, Markus PS: Please don't top-post.