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 - Print a warning for text relocations



details:   https://anonhg.NetBSD.org/src/rev/0e13efd08f34
branches:  trunk
changeset: 814858:0e13efd08f34
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 12 19:10:48 2016 +0000

description:
- Print a warning for text relocations
- Don't remap the text segment executable while relocating

diffstat:

 libexec/ld.elf_so/reloc.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r c8ce8faf9d68 -r 0e13efd08f34 libexec/ld.elf_so/reloc.c
--- a/libexec/ld.elf_so/reloc.c Tue Apr 12 18:50:45 2016 +0000
+++ b/libexec/ld.elf_so/reloc.c Tue Apr 12 19:10:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: reloc.c,v 1.107 2014/08/25 20:40:52 joerg Exp $         */
+/*     $NetBSD: reloc.c,v 1.108 2016/04/12 19:10:48 christos Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: reloc.c,v 1.107 2014/08/25 20:40:52 joerg Exp $");
+__RCSID("$NetBSD: reloc.c,v 1.108 2016/04/12 19:10:48 christos Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -170,12 +170,13 @@
                    (long)(obj->pltrelalim - obj->pltrela)));
 
                if (obj->textrel) {
+                       xwarnx("%s: text relocations", obj->path);
                        /*
                         * There are relocations to the write-protected text
                         * segment.
                         */
                        if (mprotect(obj->mapbase, obj->textsize,
-                               PROT_READ | PROT_WRITE | PROT_EXEC) == -1) {
+                               PROT_READ | PROT_WRITE) == -1) {
                                _rtld_error("%s: Cannot write-enable text "
                                    "segment: %s", obj->path, xstrerror(errno));
                                return -1;



Home | Main Index | Thread Index | Old Index