Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 24 Jan 2004 08:36:13 +0000 (08:36 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 24 Jan 2004 08:36:13 +0000 (08:36 +0000)
2004-01-22  Jakub Jelinek  <jakub@redhat.com>

* elf/dl-reloc.c (_dl_relocate_object): Move PT_GNU_RELRO protection
into...
(_dl_protect_relro): New routine.
* sysdeps/generic/ldsodefs.h (_dl_protect_relro): New prototype.
* elf/rtld.c (_dl_start_final): Copy l_relro_addr and l_relro_size
from bootstrap_map.
(_dl_main): Don't set GL(_dl_loaded)->l_relro_{addr,size} here.
Call _dl_protect_relro for libraries if prelinking.

ChangeLog
elf/rtld.c
sysdeps/generic/ldsodefs.h

index ecf1472..7e1cec2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-22  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf/dl-reloc.c (_dl_relocate_object): Move PT_GNU_RELRO protection
+       into...
+       (_dl_protect_relro): New routine.
+       * sysdeps/generic/ldsodefs.h (_dl_protect_relro): New prototype.
+       * elf/rtld.c (_dl_start_final): Copy l_relro_addr and l_relro_size
+       from bootstrap_map.
+       (_dl_main): Don't set GL(_dl_loaded)->l_relro_{addr,size} here.
+       Call _dl_protect_relro for libraries if prelinking.
+
 2004-01-23  Richard Henderson  <rth@redhat.com>
 
        * Versions.def (libm): Replace GLIBC_2.3.3 with GLIBC_2.3.4.
@@ -10,8 +21,6 @@
        * sysdeps/ieee754/dbl-64/e_pow.c (log2): Rename to my_log2 to
        avoid warnings for builtin function log2.
 
-2004-01-22  Andreas Jaeger  <aj@suse.de>
-
        * sysdeps/unix/sysv/linux/x86_64/setcontext.S: Add proper unwind
        information.
 
index 62c997a..3a8ede8 100644 (file)
@@ -224,6 +224,8 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
   memcpy (GL(dl_rtld_map).l_info, info->l.l_info,
          sizeof GL(dl_rtld_map).l_info);
   GL(dl_rtld_map).l_mach = info->l.l_mach;
+  GL(dl_rtld_map).l_relro_addr = info->l.l_relro_addr;
+  GL(dl_rtld_map).l_relro_size = info->l.l_relro_size;
 #endif
   _dl_setup_hash (&GL(dl_rtld_map));
   GL(dl_rtld_map).l_opencount = 1;
@@ -794,11 +796,6 @@ of this helper program; chances are you did not intend to run this program.\n\
            GL(dl_stack_flags) = ph->p_flags;
            break;
          }
-       else if (ph->p_type == PT_GNU_RELRO)
-         {
-           GL(dl_loaded)->l_relro_addr = ph->p_vaddr;
-           GL(dl_loaded)->l_relro_size = ph->p_memsz;
-         }
 
       if (__builtin_expect (mode, normal) == verify)
        {
@@ -1676,7 +1673,11 @@ cannot allocate TLS data structures for initial thread");
 
       /* Mark all the objects so we know they have been already relocated.  */
       for (l = GL(dl_loaded); l != NULL; l = l->l_next)
-       l->l_relocated = 1;
+       {
+         l->l_relocated = 1;
+         if (l->l_relro_size)
+           _dl_protect_relro (l);
+       }
 
       _dl_sysdep_start_cleanup ();
     }
index a05e5c7..eed7893 100644 (file)
@@ -697,6 +697,10 @@ extern void _dl_relocate_object_internal (struct link_map *map,
                                          int lazy, int consider_profiling)
      attribute_hidden;
 
+/* Protect PT_GNU_RELRO area.  */
+extern void _dl_protect_relro (struct link_map *map)
+     internal_function attribute_hidden;
+
 /* Call _dl_signal_error with a message about an unhandled reloc type.
    TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R_<CPU>_* value.
    PLT is nonzero if this was a PLT reloc; it just affects the message.  */