Re: powerpc: fork && stepping (Was: [RFC,PATCH 0/14] utrace/ptrace)

From: Ananth N Mavinakayanahalli
Date: Sat Nov 28 2009 - 02:31:14 EST


On Fri, Nov 27, 2009 at 06:46:27PM +0100, Veaceslav Falico wrote:
> On Thu, Nov 26, 2009 at 11:37:03PM +0100, Oleg Nesterov wrote:
> >
> > Could you look at this
> >
> > ptrace-copy_process-should-disable-stepping.patch
> > http://marc.info/?l=linux-mm-commits&m=125789789322573
> >
> > patch? It is not clear to me how we can modify the test-case to
> > verify it fixes the original problem for powerpc.
>
> I modified the test-case, it confirms that
> ptrace-copy_process-should-disable-stepping.patch fixes the
> problem with TIF_SINGLESTEP copied by fork() on powerpc.
>
> Probably we need a similar fix for step-fork.c in ptrace-tests.
>
> Modified the original testcase to call fork via syscall(__NR_fork),
> to avoid the looping inside libc's fork() on powerpc.
> The parent singlesteps until he sees that the child has forked, after
> that the parent PTRACE_CONTs until the child exits.

Thanks Veaceslav. This works:

Index: ptrace-tests/tests/step-fork.c
===================================================================
--- ptrace-tests.orig/tests/step-fork.c
+++ ptrace-tests/tests/step-fork.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
+#include <sys/syscall.h>
#include <signal.h>

#ifndef PTRACE_SINGLESTEP
@@ -78,7 +79,7 @@ main (int argc, char **argv)
sigprocmask (SIG_BLOCK, &mask, NULL);
ptrace (PTRACE_TRACEME);
raise (SIGUSR1);
- if (fork () == 0)
+ if (syscall(__NR_fork) == 0)
{
read (-1, NULL, 0);
_exit (22);

Oleg,
With the above patch applied, syscall-reset is the only failure I see on
powerpc:

errno 14 (Bad address)
syscall-reset: syscall-reset.c:95: main: Assertion `(*__errno_location
()) == 38' failed.
unexpected child status 67f
FAIL: syscall-reset
...
========================================
1 of 40 tests failed
(11 tests were not run)
Please report to utrace-devel@xxxxxxxxxx
========================================

Ananth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/