Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 30 May 2019 10:01:53 -0400
From: Rich Felker <>
Subject: Re: How to get base address of heap arenas

On Thu, May 30, 2019 at 03:27:24PM +0200, Szabolcs Nagy wrote:
> * sva sva <> [2019-05-30 08:59:46 -0400]:
> > I am writing a heap walk program in C and would like to know if there is
> > anything like the concept of arenas in musl. Basically, I need to have a
> > pointer to the base address of all my allocated heaps. Unfortunately
> > inspecting the musl code I found none.
> there is no such concept as "heap arena" visible to user
> code, so almost surely you don't "need a pointer to the
> base address" of it.
> try to describe what exactly you want to do (not in terms
> of libc internals, but in terms that make sense for user
> code)
> (do you want to get all memory mappings? -> try /proc/self/maps)
> (do you want to track malloc behaviour? -> try malloc interposition)
> (etc)

To further clarify, the current allocator implementation has no global
view of "the heap". It sees only free chunks and the headers or
footers of the immediately adjacent-in-address-space allocated chunks.
It's likely that the future replacement will have global tracking that
further helps ensure integrity against heap corruption attacks, but it
won't be a public API or something necessarily stable between
versions. If you want a debugging malloc, you need to interpose one;
for the past few releases, musl has supported malloc interposition.


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.