Package: ltrace
Version: 0.5-3
Severity: normal
Tags: patch
clone() test fix. The child_stack parameter pointer must be non-static and
point to the upper limit of allocated memory area, otherwise it seems to cause
memory corruption on ARM.
Correct usage based on code from nptl/tst-getpid1.c in Glibc 2.5 source.
Changelog:
2008-01-25 Anderson Lizardo <[EMAIL PROTECTED]>
* testsuite/ltrace.minor/trace-clone.c: fix memory corruption
on clone() test.
--
Anderson Lizardo
Instituto Nokia de Tecnologia
Manaus - Brazil
clone() test fix. The child_stack parameter pointer must be non-static and
point to the upper limit of allocated memory area, otherwise it seems to cause
memory corruption on ARM.
Correct usage based on code from nptl/tst-getpid1.c in Glibc 2.5 source.
Signed-off-by: Anderson Lizardo <[EMAIL PROTECTED]>
Signed-off-by: Bruna Moreira <[EMAIL PROTECTED]>
Index: ltrace-indt/testsuite/ltrace.minor/trace-clone.c
===================================================================
--- ltrace-indt.orig/testsuite/ltrace.minor/trace-clone.c 2007-12-18 21:10:23.000000000 -0400
+++ ltrace-indt/testsuite/ltrace.minor/trace-clone.c 2007-12-18 21:10:26.000000000 -0400
@@ -22,11 +22,11 @@ typedef int (* myfunc)();
int main ()
{
pid_t pid;
- static char stack[STACK_SIZE];
+ char stack[STACK_SIZE];
#ifdef __ia64__
pid = __clone2((myfunc)&child, stack, STACK_SIZE, CLONE_FS, NULL);
#else
- pid = clone((myfunc)&child, stack,CLONE_FS, NULL );
+ pid = clone((myfunc)&child, stack + STACK_SIZE,CLONE_FS, NULL );
#endif
if (pid < 0)
{