From fee9e40a8da75fad9717668f6dddcc26f3feca2d Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 1 Nov 2023 09:56:08 -0300 Subject: 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 --- elf/dl-minimal-malloc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'elf/dl-minimal-malloc.c') diff --git a/elf/dl-minimal-malloc.c b/elf/dl-minimal-malloc.c index 2754964..da36986 100644 --- a/elf/dl-minimal-malloc.c +++ b/elf/dl-minimal-malloc.c @@ -26,6 +26,7 @@ #include #include #include +#include static void *alloc_ptr, *alloc_end, *alloc_last_block; @@ -60,6 +61,7 @@ __minimal_malloc (size_t n) MAP_ANON|MAP_PRIVATE, -1, 0); if (page == MAP_FAILED) return NULL; + __set_vma_name (page, nup, " glibc: loader malloc"); if (page != alloc_end) alloc_ptr = page; alloc_end = page + nup; -- cgit v1.1