mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
malloc: Decorate malloc maps
Add anonymous mmap annotations on loader malloc, malloc when it allocates memory with mmap, and on malloc arena. The /proc/self/maps will now print: [anon: glibc: malloc arena] [anon: glibc: malloc] [anon: glibc: loader malloc] On arena allocation, glibc annotates only the read/write mapping. Checked on x86_64-linux-gnu and aarch64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <setvmaname.h>
|
||||
|
||||
#define TUNABLE_NAMESPACE malloc
|
||||
#include <elf/dl-tunables.h>
|
||||
@@ -436,6 +437,9 @@ alloc_new_heap (size_t size, size_t top_pad, size_t pagesize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Only considere the actual usable range. */
|
||||
__set_vma_name (p2, size, " glibc: malloc arena");
|
||||
|
||||
madvise_thp (p2, size);
|
||||
|
||||
h = (heap_info *) p2;
|
||||
|
Reference in New Issue
Block a user