Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 2 Jun 2019 21:32:08 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: How to get base address of heap arenas

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 it.
> 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.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.