From 82f40691c487cdba16149a675f32851558992654 Mon Sep 17 00:00:00 2001 From: guenther Date: Mon, 4 Jul 2016 04:33:35 +0000 Subject: [PATCH] The GOT has been initally mapped RW for *years*; ld.so doesn't need to mprotect it to RW when filling in the references from the PLT in snaps for a week, ok deraadt@ --- libexec/ld.so/i386/rtld_machine.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c index f827a120e59..f5d1521df13 100644 --- a/libexec/ld.so/i386/rtld_machine.c +++ b/libexec/ld.so/i386/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.34 2016/05/26 17:23:39 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.35 2016/07/04 04:33:35 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -420,7 +420,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT]; int i, num; Elf_Rel *rel; - struct load_list *llist; if (pltgot == NULL) return (0); /* it is possible to have no PLT/GOT relocations */ @@ -439,24 +438,11 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) rel = (Elf_Rel *)(object->Dyn.info[DT_JMPREL]); num = (object->Dyn.info[DT_PLTRELSZ]); - 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); - } for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) { Elf_Addr *where; where = (Elf_Addr *)(rel->r_offset + object->obj_base); *where += object->obj_base; } - for (llist = object->load_list; llist != NULL; - llist = llist->next) { - if (!(llist->prot & PROT_WRITE)) - _dl_mprotect(llist->start, llist->size, - llist->prot); - } - } /* mprotect the GOT */ -- 2.20.1