[uClibc-cvs] uClibc/ldso/ldso dl-startup.c,1.10,1.11

Erik Andersen andersen at uclibc.org
Wed May 12 23:11:32 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso
In directory nail:/tmp/cvs-serv1030/ldso

Modified Files:
	dl-startup.c 
Log Message:
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.



Index: dl-startup.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/dl-startup.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- a/dl-startup.c	11 May 2004 19:13:26 -0000	1.10
+++ b/dl-startup.c	12 May 2004 23:11:30 -0000	1.11
@@ -377,13 +377,18 @@
 					}
 					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++;




More information about the uClibc-cvs mailing list