ptmalloc
Glibc dynamic memory allocator
What is ptmalloc2
ptmalloc2 is the dynamic memory allocator used by glibc since version 2.3.x. It is a fork of the original malloc with improved multi-threading support. It is also very fast (6 times faster) compared to the original malloc. Specifically, we are interested in the implementation of malloc.c. The very first step of getting into heap exploitation is reading malloc.c and understanding its algorithms.
Setup
Download and extract the latest glibc (the current version is 2.35):
cd /usr/src/glibc
sudo wget http://mirror.ibcp.fr/pub/gnu/libc/glibc-2.35.tar.xz
sudo tar xf glibc-2.35.tar.xzThe malloc.c file can be found at /usr/src/glibc/glibc-2.35/malloc.
Reference
Last updated
Was this helpful?
