[uClibc] Re: uclibc and heap randomisation (ET_EXEC)

Peter S. Mazinger ps.m at gmx.net
Mon Aug 30 15:25:23 UTC 2004


On Sat, 14 Aug 2004, Peter S. Mazinger wrote:

> Hello!
> 
> The latest uclibc-cvs solved the heap randomisation issue on PAX enabled 
> kernels

The attached patch killed again heap reandomisation (it was 
applied to cvs between aug.27-30, don't know exactly).
Is it really necessary?

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
-------------- next part --------------
diff -u uClibc/ldso/ldso/ldso.c uClibc/ldso/ldso/ldso.c
--- uClibc/ldso/ldso/ldso.c	Fri Aug 27 09:18:54 2004
+++ uClibc/ldso/ldso/ldso.c	Mon Aug 30 09:58:12 2004
@@ -99,6 +99,8 @@
 	struct r_debug *debug_addr;
 	unsigned long brk_addr, *lpnt;
 	int (*_dl_atexit) (void *);
+	unsigned long *_dl_brkp;		/* The end of the data segment for brk and sbrk */
+	unsigned long *_dl_envp;		/* The environment address */
 #if defined (__SUPPORT_LD_DEBUG__)
 	int (*_dl_on_exit) (void (*FUNCTION)(int STATUS, void *ARG),void*);
 #endif
@@ -689,6 +691,14 @@
 	   dynamicly linked if we are using ld.so.1, so we have to look
 	   up each symbol individually. */
 
+	_dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("__curbrk", _dl_symbol_tables, 0);
+	if (_dl_brkp)
+		*_dl_brkp = brk_addr;
+
+	_dl_envp = (unsigned long *) (intptr_t) _dl_find_hash("__environ", _dl_symbol_tables, 0);
+	if (_dl_envp)
+		*_dl_envp = (unsigned long) envp;
+
 #ifndef FORCE_SHAREABLE_TEXT_SEGMENTS
 	{
 		unsigned int j;


More information about the uClibc mailing list