As noted by kettenis@, all sparc64 binaries from 6.0-release forward
should have their .plt segments marked as RWX, and thus initially mapped
as RW but updated to RX after relocation. Given that, mprotecting
[__plt_start, __plt_end) is no longer necessary there.
I've eyeballed the readelf output of the most recent sparc binaries and
they follow this rule as well.
So, continuing my stealing of good ideas from kettenis@, let's delete the
obsolete code for those.
ok?
Philip
Index: sparc/rtld_machine.c
===================================================================
RCS file: /cvs/src/libexec/ld.so/sparc/rtld_machine.c,v
retrieving revision 1.44
diff -u -p -r1.44 rtld_machine.c
--- sparc/rtld_machine.c 21 Jun 2016 15:25:38 -0000 1.44
+++ sparc/rtld_machine.c 9 Aug 2016 05:09:29 -0000
@@ -455,10 +455,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);
}
Index: sparc64/rtld_machine.c
===================================================================
RCS file: /cvs/src/libexec/ld.so/sparc64/rtld_machine.c,v
retrieving revision 1.58
diff -u -p -r1.58 rtld_machine.c
--- sparc64/rtld_machine.c 21 Jun 2016 15:25:38 -0000 1.58
+++ sparc64/rtld_machine.c 9 Aug 2016 05:09:29 -0000
@@ -847,10 +847,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 {
@@ -862,10 +858,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);
}