Fix mapping of DSOs with holes

Andreas Schwab schwab@suse.de
Tue May 18 19:33:00 GMT 2004


This reverts parts of the changes of 2004-03-26 in dl-load.c.  The
mprotect call would otherwise try to change the mapping at address 0
because l_text_end hasn't been set yet.  And even if it would have been it
is the wrong address anyway because we want the end address of the first
segment, not the highest address of any executable segment (which on ppc
includes the data segment because the PLT is located in the bss segment).

Andreas.

2004-05-18  Andreas Schwab  <schwab@suse.de>

	* elf/dl-load.c (_dl_map_object_from_fd): Use the end address of
	the first segment for mprotect, not l_text_end.

--- elf/dl-load.c	08 May 2004 20:27:56 +0200	1.241
+++ elf/dl-load.c	18 May 2004 01:48:53 +0200	
@@ -1110,7 +1110,7 @@ cannot allocate TLS data structures for 
 	     unallocated.  Then jump into the normal segment-mapping loop to
 	     handle the portion of the segment past the end of the file
 	     mapping.  */
-	  __mprotect ((caddr_t) l->l_text_end,
+	  __mprotect ((caddr_t) (l->l_addr + c->mapend),
 		      loadcmds[nloadcmds - 1].allocend - c->mapend,
 		      PROT_NONE);
 

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-hacker mailing list