diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2019-08-06 04:01:43 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2019-08-06 04:01:43 +0000 |
commit | 21e018dd1b35b1a125508d175c9d88d09329c8a4 (patch) | |
tree | cdeb0271b2d6a717d602dbfbf2703e7106381b3d /libexec/ld.so/amd64 | |
parent | 0501f61ae1cebabdc79070fbdfb22a1902d21f6e (diff) |
Factor out TEXTREL mprotecting from the per-arch files into _dl_rtld(),
hiding the actual grotty bits in inline functions
ok mpi@
Diffstat (limited to 'libexec/ld.so/amd64')
-rw-r--r-- | libexec/ld.so/amd64/rtld_machine.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/libexec/ld.so/amd64/rtld_machine.c b/libexec/ld.so/amd64/rtld_machine.c index 012b2cf2eb1..10b808c6c85 100644 --- a/libexec/ld.so/amd64/rtld_machine.c +++ b/libexec/ld.so/amd64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.32 2019/08/04 23:51:45 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.33 2019/08/06 04:01:41 guenther Exp $ */ /* * Copyright (c) 2002,2004 Dale Rahn @@ -179,7 +179,6 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf_Addr prev_value = 0; const Elf_Sym *prev_sym = NULL; Elf_RelA *rels; - struct load_list *llist; loff = object->obj_base; numrel = object->Dyn.info[relsz] / sizeof(Elf_RelA); @@ -191,17 +190,6 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) if (relrel > numrel) _dl_die("relacount > numrel: %ld > %ld", relrel, numrel); - /* - * unprotect some segments if we need it. - */ - if ((object->dyn.textrel == 1) && (rel == DT_REL || rel == DT_RELA)) { - for (llist = object->load_list; llist != NULL; llist = llist->next) { - if (!(llist->prot & PROT_WRITE)) - _dl_mprotect(llist->start, llist->size, - PROT_READ | PROT_WRITE); - } - } - /* tight loop for leading RELATIVE relocs */ for (i = 0; i < relrel; i++, rels++) { Elf_Addr *where; @@ -312,15 +300,6 @@ resolve_failed: } } - /* reprotect the unprotected segments */ - if ((object->dyn.textrel == 1) && (rel == DT_REL || rel == DT_RELA)) { - for (llist = object->load_list; llist != NULL; llist = llist->next) { - if (!(llist->prot & PROT_WRITE)) - _dl_mprotect(llist->start, llist->size, - llist->prot); - } - } - return (fails); } |