diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-01 09:56:08 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-07 10:27:20 -0300 |
commit | fee9e40a8da75fad9717668f6dddcc26f3feca2d (patch) | |
tree | 318af06cfcad98364192c6b01bb2a0ed6a08b577 /elf/dl-minimal-malloc.c | |
parent | 6afce56c197ee83520994a2c94a82c2ca2bce9fa (diff) | |
download | glibc-fee9e40a8da75fad9717668f6dddcc26f3feca2d.zip glibc-fee9e40a8da75fad9717668f6dddcc26f3feca2d.tar.gz glibc-fee9e40a8da75fad9717668f6dddcc26f3feca2d.tar.bz2 |
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>
Diffstat (limited to 'elf/dl-minimal-malloc.c')
-rw-r--r-- | elf/dl-minimal-malloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
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 <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; |