Note that there are some explanatory texts on larger screens.

plurals
  1. POCode description of ptmalloc implementation
    primarykey
    data
    text
    <p>I'm looking forward to understanding how dynamic memory management works at low level in GNU/Linux systems (aka, how ptmalloc works).</p> <p>Of course, I've read the code but I have a lot of doubts. I, more or less, understand the data structures but I have many information leaks!</p> <p>My question is if someone knows about any resource explaining in detail the implementation. For example, I've read papers such as 'Understanding the heap by breaking it' or the 'Malloc Malleficarum' series and post-series. They do a great job, but, of course, they are more focused in exploitation than in explaining many implementation details.</p> <p>If you don't know about any resource, here are some of my questions.</p> <ul> <li><p>What really is an arena? In the code for the variable <strong>ar_ptr</strong> from <strong>heap_info</strong> struct there is a comment saying 'arena for this heap', so an arena can not be a heap (as it is said everywhere).</p></li> <li><p>Why in the <strong>heap_info</strong> struct there is not a next pointer and there is a <strong>prev</strong> pointer? Is it because of <strong>main_arena</strong>? And what is <strong>main_arena</strong>?</p></li> <li><p>Every <strong>heap_info</strong> struct can have more than one arena (pointing to different <strong>malloc_state</strong> structures)?</p></li> <li><p>When are created news arenas and what code handles it? I've read that new arenas are created when an arena requested for storing data is locked (because the process or a process thread is working with it) and I've also read that each process thread have a different arena. The important thing here is if you know <strong>what code handle these situations</strong>.</p></li> <li><p>I also don't understand when people says that all memory operations born from the top chunk or wilderest chunk. Do you know where can I found this code?</p></li> </ul> <p>BTW, I don't want to go deep with mutex details.</p> <p>I'm reviewing ptmalloc implementation in glibc 2.12.1. I would like to make some diagrams about the overall structure of everything so I need to understand these things!</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload