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
This commit is contained in:
Ed Maste 2016-01-08 00:56:41 +00:00
parent 45b2ffd09e
commit b873436a30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=293403
2 changed files with 2 additions and 5 deletions

View File

@ -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;

View File

@ -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 (%) */