From b873436a30729e357a67082260439172fa2a0b50 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 8 Jan 2016 00:56:41 +0000 Subject: [PATCH] Revert r293201, r293202 (rtld: populate DT_DEBUG iff DYNAMIC segment is writable) It turns out MIPS binaries may have other oddities that can trigger a fault at startup. PR: 206017 Reported by: ray --- libexec/rtld-elf/rtld.c | 6 ++---- libexec/rtld-elf/rtld.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 424f2eafd7ce..ad5d359452d4 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1144,13 +1144,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath, * is mapped read-only. DT_MIPS_RLD_MAP is used instead. */ +#ifndef __mips__ case DT_DEBUG: - if (!obj->writable_dynamic) - break; if (!early) dbg("Filling in DT_DEBUG entry"); ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug; break; +#endif case DT_FLAGS: if (dynp->d_un.d_val & DF_ORIGIN) @@ -1331,8 +1331,6 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) break; case PT_DYNAMIC: - if (ph->p_flags & PROT_WRITE) - obj->writable_dynamic = true; obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index f151db0d1c7b..72a632e912e6 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -264,7 +264,6 @@ typedef struct Struct_Obj_Entry { bool valid_hash_sysv : 1; /* A valid System V hash hash tag is available */ bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */ bool dlopened : 1; /* dlopen()-ed (vs. load statically) */ - bool writable_dynamic : 1; /* PT_DYNAMIC is writable */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */