svn commit: branches/uClibc_0_9_29/libc/unistd

vapier at uclibc.org vapier at uclibc.org
Tue Jan 8 06:44:36 UTC 2008


Author: vapier
Date: 2008-01-07 22:44:36 -0800 (Mon, 07 Jan 2008)
New Revision: 20814

Log:
fix memory corruption on no-mmu from doing multiple execls where earlier execls fail by simply not releasing the memory reserved for the arguments of children processes

Modified:
   branches/uClibc_0_9_29/libc/unistd/exec.c


Changeset:
Modified: branches/uClibc_0_9_29/libc/unistd/exec.c
===================================================================
--- branches/uClibc_0_9_29/libc/unistd/exec.c	2008-01-08 06:44:19 UTC (rev 20813)
+++ branches/uClibc_0_9_29/libc/unistd/exec.c	2008-01-08 06:44:36 UTC (rev 20814)
@@ -63,19 +63,12 @@
 
 # define EXEC_ALLOC_SIZE(VAR)	size_t VAR;	/* Semicolon included! */
 # define EXEC_ALLOC(SIZE,VAR)	__exec_alloc((VAR = (SIZE)))
-# define EXEC_FREE(PTR,VAR)		__exec_free((PTR),(VAR))
+# define EXEC_FREE(PTR,VAR)		((void)0)
 
 extern void *__exec_alloc(size_t size) attribute_hidden;
-extern void __exec_free(void *ptr, size_t size) attribute_hidden;
 
 # ifdef L___exec_alloc
 
-void attribute_hidden __exec_free(void *ptr, size_t size)
-{
-	if (ptr)
-		munmap(ptr, size);
-}
-
 void attribute_hidden *__exec_alloc(size_t size)
 {
 	static void *p;
@@ -83,8 +76,8 @@
 
 	if (old_size >= size)
 		return p;
-	else
-		__exec_free(p, old_size);
+	else if (p)
+		munmap(p, old_size);
 
 	old_size = size;
 	p = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);




More information about the uClibc-cvs mailing list