about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-04-07 17:04:59 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-08-05 19:45:19 +0100
commit2b1192cae03642b2cb16f918322f5cddfc54eae2 (patch)
tree1c862b3989202ee562e2b83e9eca33558fabadd7
parent06fda784450ff505a14c0af87a5c68e153b08b31 (diff)
downloadglibc-2b1192cae03642b2cb16f918322f5cddfc54eae2.tar.gz
glibc-2b1192cae03642b2cb16f918322f5cddfc54eae2.tar.xz
glibc-2b1192cae03642b2cb16f918322f5cddfc54eae2.zip
cheri: elf: fix pointer provenance of l_tls_initimage
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/rtld.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1ad0868dad..367b8cdab1 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1369,7 +1369,7 @@ cannot enable executable stack as shared object requires");
 
   /* Adjust the address of the TLS initialization image.  */
   if (l->l_tls_initimage != NULL)
-    l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
+    l->l_tls_initimage = (ElfW(Addr)) l->l_tls_initimage + (char *) l->l_addr;
 
   /* Process program headers again after load segments are mapped in
      case processing requires accessing those segments.  Scan program
diff --git a/elf/rtld.c b/elf/rtld.c
index 2c61935a21..6ba7b94761 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1274,7 +1274,7 @@ rtld_setup_main_map (struct link_map *main_map)
      the executable is actually an ET_DYN object.  */
   if (main_map->l_tls_initimage != NULL)
     main_map->l_tls_initimage
-      = (char *) main_map->l_tls_initimage + main_map->l_addr;
+      = (ElfW(Addr)) main_map->l_tls_initimage + (char *) main_map->l_addr;
   if (! main_map->l_map_end)
     main_map->l_map_end = ~0;
   if (! main_map->l_text_end)