Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Move relro after we've computed out relocb...



details:   https://anonhg.NetBSD.org/src/rev/4fed4d4ab7d8
branches:  trunk
changeset: 345938:4fed4d4ab7d8
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 16 11:34:13 2016 +0000

description:
Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)

diffstat:

 libexec/ld.elf_so/Makefile     |   4 ++--
 libexec/ld.elf_so/map_object.c |  14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r 9564fae228f5 -r 4fed4d4ab7d8 libexec/ld.elf_so/Makefile
--- a/libexec/ld.elf_so/Makefile        Thu Jun 16 06:20:08 2016 +0000
+++ b/libexec/ld.elf_so/Makefile        Thu Jun 16 11:34:13 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.132 2016/06/15 12:08:47 christos Exp $
+#      $NetBSD: Makefile,v 1.133 2016/06/16 11:34:13 christos Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -93,7 +93,7 @@
 CPPFLAGS+=     -DLIBDIR=\"${LIBDIR}\" -D_PATH_RTLD=\"${BINDIR}/${PROG}\"
 CPPFLAGS+=     -I${.CURDIR} -I. -D_KERNTYPES
 CPPFLAGS+=     -DRTLD_LOADER
-#CPPFLAGS+=    -DGNU_RELRO
+CPPFLAGS+=     -DGNU_RELRO
 CPPFLAGS+=     -D_RTLD_SOURCE
 CPPFLAGS+=     -DCOMBRELOC
 #CPPFLAGS+=    -DDEBUG
diff -r 9564fae228f5 -r 4fed4d4ab7d8 libexec/ld.elf_so/map_object.c
--- a/libexec/ld.elf_so/map_object.c    Thu Jun 16 06:20:08 2016 +0000
+++ b/libexec/ld.elf_so/map_object.c    Thu Jun 16 11:34:13 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: map_object.c,v 1.54 2016/06/14 13:06:41 christos Exp $  */
+/*     $NetBSD: map_object.c,v 1.55 2016/06/16 11:34:13 christos Exp $  */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.54 2016/06/14 13:06:41 christos Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.55 2016/06/16 11:34:13 christos Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -282,11 +282,6 @@
        obj->vaddrbase = base_vaddr;
        obj->isdynamic = ehdr->e_type == ET_DYN;
 
-#ifdef GNU_RELRO
-       obj->relro_page = obj->relocbase + round_down(relro_page);
-       obj->relro_size = round_up(relro_size);
-#endif
-
 #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
        if (phtls != NULL) {
                ++_rtld_tls_dtv_generation;
@@ -408,6 +403,11 @@
        obj->mapsize = mapsize;
        obj->relocbase = mapbase - base_vaddr;
 
+#ifdef GNU_RELRO
+       obj->relro_page = obj->relocbase + round_down(relro_page);
+       obj->relro_size = round_up(relro_size);
+#endif
+
        if (obj->dynamic)
                obj->dynamic = (void *)(obj->relocbase + (Elf_Addr)(uintptr_t)obj->dynamic);
        if (obj->entry)



Home | Main Index | Thread Index | Old Index