clone bug (glibc?) (Was: clone-multi-ptrace test failure)

Jan Kratochvil jan.kratochvil at redhat.com
Mon Dec 14 09:53:37 UTC 2009


On Tue, 01 Dec 2009 20:39:40 +0100, Roland McGrath wrote:
> I think the best bet is to link with -Wl,-z,now and then minimize the
> library code you rely on.

Checked-in the fix of at least Fedora 12 x86_64 below.

getppid() does not look to be needed there - PTRACE_SYSCALL does stop
(WIFSTOPPED) on the entry (before WIFEXITED) to __NR_exit keeping the
PASS/FAIL reproducibility.


Regards,
Jan


--- Makefile.am	29 Nov 2009 02:23:25 -0000	1.60
+++ Makefile.am	14 Dec 2009 09:47:54 -0000	1.61
@@ -111,6 +111,8 @@ stopped_attach_transparency_LDFLAGS = -l
 erestartsys_trap_LDFLAGS = -lutil
 erestartsys_trap_debugger_LDFLAGS = -lutil
 erestartsys_trap_32fails_debugger_LDFLAGS = -lutil
+# After clone syscall it must call no glibc code (such as _dl_runtime_resolve).
+clone_multi_ptrace_LDFLAGS = -Wl,-z,now
 
 check_TESTS = $(SAFE)
 xcheck_TESTS = $(CRASHERS)
--- clone-multi-ptrace.c	5 Dec 2008 14:41:57 -0000	1.6
+++ clone-multi-ptrace.c	14 Dec 2009 09:47:54 -0000	1.7
@@ -65,10 +65,10 @@ static char grandchild_seen[THREAD_NUM];
 static int
 grandchild_func (void *unused)
 {
-  /* Need to have at least one syscall before exit */
-  getppid ();
-  /* _exit() would make ALL threads to exit. We need rew syscall */
+  /* _exit() would make ALL threads to exit.  We need rew syscall.  After the
+     clone syscall it must call no glibc code (such as _dl_runtime_resolve).  */
   syscall (__NR_exit, 22);
+
   return 0;
 }
 




More information about the utrace-devel mailing list