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

From: Veaceslav Falico
Date: Thu Nov 26 2009 - 13:23:00 EST


On Thu, Nov 26, 2009 at 06:25:24PM +0100, Oleg Nesterov wrote:
> On 11/26, Oleg Nesterov wrote:
> >
> > On 11/26, Ananth N Mavinakayanahalli wrote:
> > >
> > > step-fork: step-fork.c:56: handler_fail: Assertion `0' failed.
> > > /bin/sh: line 5: 17325 Aborted ${dir}$tst
> > > FAIL: step-fork
> >
> > Good to know, thanks again Ananth.
> >
> > I'll take a look. Since I know nothing about powerpc, I can't
> > promise the quick fix ;)
> >
> > The bug was found by code inspection, but the fix is not trivial
> > because it depends on arch/, and it turns out the arch-independent
> > fix in
> >
> > ptrace-copy_process-should-disable-stepping.patch
> > http://marc.info/?l=linux-mm-commits&m=125789789322573
> >
> > doesn't work.
>
> Just noticed the test-case fails in handler_fail(). Most probably
> this means it is killed by SIGALRM because either parent or child
> hang in wait(). Perhaps we have another (ppc specific?) bug, but
> currently I do not understand how this is possible, this should
> not be arch-dependent.

I can confirm that we have another bug on ppc arch. The test case below
is spinning forever,

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <assert.h>

int main(void)
{
int pid, status;

if (!(pid = fork())) {
assert(ptrace(PTRACE_TRACEME) == 0);
kill(getpid(), SIGSTOP);

if (!fork())
return 0;

printf("fork passed..\n");

return 0;
}

for (;;) {
assert(pid == wait(&status));
if (WIFEXITED(status))
break;
assert(ptrace(PTRACE_SINGLESTEP, pid, 0,0) == 0);
}

printf("Parent exit.\n");

return 0;
}

it doesn't hang, the parent is spinning around for, the test case
isn't printing anything. Seems like fork() can't complete under
PTRACE_SINGLESTEP.

--
Veaceslav
--
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/