aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2016-01-05 15:52:16 +0000
committerEd Maste <emaste@FreeBSD.org>2016-01-05 15:52:16 +0000
commit7a2ff73d68079d4a7f23957712e566865d4491d6 (patch)
tree265597f93435cab4a790bb5a47d7e93151319d8b /libexec
parent1041e09089dcd722ef14f51070828c9473b33984 (diff)
downloadsrc-7a2ff73d68079d4a7f23957712e566865d4491d6.tar.gz
src-7a2ff73d68079d4a7f23957712e566865d4491d6.zip
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 66edc157d393..6daef2d13405 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,6 +1331,8 @@ 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;