mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +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:
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <ldsodefs.h>
|
||||
#include <malloc/malloc-internal.h>
|
||||
#include <setvmaname.h>
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user