It's been a year since the ldscripts have created __plt_start or __plt_end 
symbols, so references to them will never resolve.  Just delete the 
_dl_protect_segment() calls that are dependent on one or both of those 
symbols.

ok?

Philip Guenther


Index: libexec/ld.so/alpha/rtld_machine.c
===================================================================
RCS file: /data/src/openbsd/src/libexec/ld.so/alpha/rtld_machine.c,v
retrieving revision 1.61
diff -u -p -r1.61 rtld_machine.c
--- libexec/ld.so/alpha/rtld_machine.c  16 Feb 2017 13:31:10 -0000      1.61
+++ libexec/ld.so/alpha/rtld_machine.c  9 Sep 2017 03:34:08 -0000
@@ -306,11 +306,6 @@ _dl_md_reloc_got(elf_object_t *object, i
        _dl_protect_segment(object, seg_start, "__got_start", "__got_end",
            PROT_READ);
 
-       /* mprotect the PLT, if it isn't already read-only */
-       if (pltro == 0)
-               _dl_protect_segment(object, (Elf_Addr)pltgot, "__plt_start",
-                   "__plt_end", PROT_READ|PROT_EXEC);
-
        return (fails);
 }
 
Index: libexec/ld.so/powerpc/rtld_machine.c
===================================================================
RCS file: /data/src/openbsd/src/libexec/ld.so/powerpc/rtld_machine.c,v
retrieving revision 1.62
diff -u -p -r1.62 rtld_machine.c
--- libexec/ld.so/powerpc/rtld_machine.c        24 Jan 2017 10:59:10 -0000      
1.62
+++ libexec/ld.so/powerpc/rtld_machine.c        9 Sep 2017 03:28:38 -0000
@@ -573,10 +573,6 @@ _dl_md_reloc_got(elf_object_t *object, i
        if (prot_exec != 0 && got_addr != NULL)
                _dl_syncicache(got_addr, 4);
 
-       /* mprotect the PLT */
-       _dl_protect_segment(object, 0, "__plt_start", "__plt_end",
-           PROT_READ|prot_exec);
-
        return (fails);
 }
 
Index: libexec/ld.so/sparc64/rtld_machine.c
===================================================================
RCS file: /data/src/openbsd/src/libexec/ld.so/sparc64/rtld_machine.c,v
retrieving revision 1.60
diff -u -p -r1.60 rtld_machine.c
--- libexec/ld.so/sparc64/rtld_machine.c        28 Aug 2017 14:06:22 -0000      
1.60
+++ libexec/ld.so/sparc64/rtld_machine.c        9 Sep 2017 03:25:15 -0000
@@ -841,10 +841,6 @@ _dl_md_reloc_got(elf_object_t *object, i
        if (object->traced)
                lazy = 1;
 
-       /* temporarily make the PLT writable */
-       _dl_protect_segment(object, 0, "__plt_start", "__plt_end",
-           PROT_READ|PROT_WRITE);
-
        if (!lazy) {
                fails = _dl_md_reloc_all_plt(object);
        } else {
@@ -856,10 +852,6 @@ _dl_md_reloc_got(elf_object_t *object, i
 
        /* mprotect the GOT */
        _dl_protect_segment(object, 0, "__got_start", "__got_end", PROT_READ);
-
-       /* mprotect the PLT */
-       _dl_protect_segment(object, 0, "__plt_start", "__plt_end",
-           PROT_READ|PROT_EXEC);
 
        return (fails);
 }

Reply via email to