about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-01-24 08:33:05 +0000
committerUlrich Drepper <drepper@redhat.com>2004-01-24 08:33:05 +0000
commit75631a576303d3bf23c0db077dcf5dc15c863063 (patch)
treebf158608f591bd839726d4fdb28dcefb0cfb2d97 /elf
parente151ce7ad365cfb354201af1a4ac64dc5e4efa34 (diff)
downloadglibc-75631a576303d3bf23c0db077dcf5dc15c863063.tar.gz
glibc-75631a576303d3bf23c0db077dcf5dc15c863063.tar.xz
glibc-75631a576303d3bf23c0db077dcf5dc15c863063.zip
(_dl_relocate_object): Move PT_GNU_RELRO protection into... (_dl_protect_relro): New routine.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-reloc.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 21d1871c6d..0fda3de3a7 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -311,23 +311,25 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
   /* In case we can protect the data now that the relocations are
      done, do it.  */
   if (l->l_relro_size != 0)
-    {
-      ElfW(Addr) start = ((l->l_addr + l->l_relro_addr)
-			  & ~(GL(dl_pagesize) - 1));
-      ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size)
-			& ~(GL(dl_pagesize) - 1));
+    _dl_protect_relro (l);
+}
+INTDEF (_dl_relocate_object)
 
-      if (start != end
-	  && __mprotect ((void *) start, end - start, PROT_READ) < 0)
-	{
-	  errstring = N_("\
+void internal_function
+_dl_protect_relro (struct link_map *l)
+{
+  ElfW(Addr) start = ((l->l_addr + l->l_relro_addr) & ~(GL(dl_pagesize) - 1));
+  ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size)
+		    & ~(GL(dl_pagesize) - 1));
+
+  if (start != end
+      && __mprotect ((void *) start, end - start, PROT_READ) < 0)
+    {
+      const char *errstring = N_("\
 cannot apply additional memory protection after relocation");
-	  goto call_error;
-	}
+      INTUSE(_dl_signal_error) (errno, l->l_name, NULL, errstring);
     }
 }
-INTDEF (_dl_relocate_object)
-
 
 void
 internal_function __attribute_noinline__