[uClibc] [PATCH] ld.so mprotect rwx .dyanmic segment for mips DT_DEBUG

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


On Wed May 12, 2004 at 06:56:39PM -0400, Bradley D. LaRonde wrote:
> --- uClibc/ldso/ldso/dl-startup.c.orig	2004-05-11 07:14:58.000000000 -0400
> +++ uClibc/ldso/ldso/dl-startup.c	2004-05-12 18:50:43.000000000 -0400
> @@ -377,13 +377,18 @@
>  					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;

applied

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list