about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-11-01 09:56:07 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-11-07 10:27:20 -0300
commit6afce56c197ee83520994a2c94a82c2ca2bce9fa (patch)
tree973adf10b4992c1440fc3c4352165f599747474b /elf/Makefile
parented318beab986c6f6ccf2507d4753dfea6a7b1f8d (diff)
downloadglibc-6afce56c197ee83520994a2c94a82c2ca2bce9fa.tar.gz
glibc-6afce56c197ee83520994a2c94a82c2ca2bce9fa.tar.xz
glibc-6afce56c197ee83520994a2c94a82c2ca2bce9fa.zip
nptl: Decorate thread stack on pthread_create
Linux 4.5 removed thread stack annotations due to the complexity of
computing them [1], and Linux added PR_SET_VMA_ANON_NAME on 5.17
as a way to name anonymous virtual memory areas.

This patch adds decoration on the stack created and used by
pthread_create, for glibc crated thread stack the /proc/self/maps will
now show:

  [anon: glibc: pthread stack: <tid>]

And for user-provided stacks:

  [anon: glibc: pthread user stack: <tid>]

The guard page is not decorated, and the mapping name is cleared when
the thread finishes its execution (so the cached stack does not have any
name associated).

Checked on x86_64-linux-gnu aarch64 aarch64-linux-gnu.

[1] https://github.com/torvalds/linux/commit/65376df582174ffcec9e6471bf5b0dd79ba05e4a

Co-authored-by: Ian Rogers <irogers@google.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile
index b46dee1c16..33f88bae96 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -303,6 +303,7 @@ tests := \
   tst-array4 \
   tst-array5 \
   tst-auxv \
+  tst-decorate-maps \
   tst-dl-hash \
   tst-leaks1 \
   tst-stringtable \
@@ -2980,3 +2981,5 @@ LDFLAGS-tst-dlclose-lazy-mod1.so = -Wl,-z,lazy,--no-as-needed
 $(objpfx)tst-dlclose-lazy-mod1.so: $(objpfx)tst-dlclose-lazy-mod2.so
 $(objpfx)tst-dlclose-lazy.out: \
   $(objpfx)tst-dlclose-lazy-mod1.so $(objpfx)tst-dlclose-lazy-mod2.so
+
+$(objpfx)tst-decorate-maps: $(shared-thread-library)