aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2023-12-27 17:17:11 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2024-02-13 10:29:24 +0000
commitfcdce58087260a68d1a74b28e5b0146e69511f16 (patch)
treef5fd9e2fb15cde120ca59e75af14ff47dea3a773
parent84bfdb91bded2358b2642eed3bdae3c049576eb4 (diff)
downloadglibc-fcdce58087260a68d1a74b28e5b0146e69511f16.tar
glibc-fcdce58087260a68d1a74b28e5b0146e69511f16.tar.gz
glibc-fcdce58087260a68d1a74b28e5b0146e69511f16.tar.bz2
glibc-fcdce58087260a68d1a74b28e5b0146e69511f16.zip
aarch64: process gnu properties in static exe
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libc-start.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-start.h b/sysdeps/unix/sysv/linux/aarch64/libc-start.h
index ccf0f8af5c..6e2e9762ee 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc-start.h
+++ b/sysdeps/unix/sysv/linux/aarch64/libc-start.h
@@ -21,6 +21,8 @@
#ifndef SHARED
+# include <dl-prop.h>
+
# ifndef PR_SET_SHADOW_STACK_STATUS
# define PR_GET_SHADOW_STACK_STATUS 71
# define PR_SET_SHADOW_STACK_STATUS 72
@@ -36,6 +38,16 @@ aarch64_libc_setup_tls (void)
{
__libc_setup_tls ();
+ struct link_map *main_map = _dl_get_dl_main_map ();
+ const ElfW(Phdr) *phdr = GL(dl_phdr);
+ const ElfW(Phdr) *ph;
+ for (ph = phdr; ph < phdr + GL(dl_phnum); ph++)
+ if (ph->p_type == PT_GNU_PROPERTY)
+ {
+ _dl_process_pt_gnu_property (main_map, -1, ph);
+ _rtld_main_check (main_map, _dl_argv[0]);
+ break;
+ }
uint64_t s = GL(dl_aarch64_gcs);
if (s != 0)
INLINE_SYSCALL_CALL (prctl, PR_SET_SHADOW_STACK_STATUS, s, 0, 0, 0);