summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-startup.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-05-12 23:11:30 +0000
committerEric Andersen <andersen@codepoet.org>2004-05-12 23:11:30 +0000
commit8525fd1b9781796c8ccd560f777a5e41c2de7d8b (patch)
treed8ea8844f5c1dfe253437ec5e781af0aabf4accc /ldso/ldso/dl-startup.c
parentb8361e2e12f612cf302bc03c2c9e7a648c37a84e (diff)
Patch from Bradley D. LaRonde:
ld.so mprotect rwx .dyanmic segment for mips DT_DEBUG Allow writing debug_addr into the .dynamic segment. Even though the program header is marked RWE, the kernel gives it to us rx.
Diffstat (limited to 'ldso/ldso/dl-startup.c')
-rw-r--r--ldso/ldso/dl-startup.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 1bb480e86..9b6ef76c6 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -377,13 +377,18 @@ found_got:
}
app_tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val;
-#warning "Debugging threads on mips won't work till someone fixes this..."
-#if 0
if (dpnt->d_tag == DT_DEBUG) {
+ /* Allow writing debug_addr into the .dynamic segment.
+ * Even though the program header is marked RWE, the kernel gives
+ * it to us rx.
+ */
+ Elf32_Addr mpa = (ppnt->p_vaddr + app_tpnt->loadaddr) & ~(_dl_pagesize - 1);
+ if(_dl_mprotect(mpa, ppnt->p_memsz, PROT_READ | PROT_WRITE | PROT_EXEC)) {
+ SEND_STDERR("Couldn't mprotect .dynamic segment to rwx.\n");
+ _dl_exit(0);
+ }
dpnt->d_un.d_val = (unsigned long) debug_addr;
}
-#endif
-
#else
if (dpnt->d_tag > DT_JMPREL) {
dpnt++;