[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091127174627.GB26193@darkmag.usersys.redhat.com>
Date: Fri, 27 Nov 2009 18:46:27 +0100
From: Veaceslav Falico <vfalico@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Christoph Hellwig <hch@...radead.org>,
"Frank Ch. Eigler" <fche@...hat.com>, Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org, utrace-devel@...hat.com,
Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: Re: powerpc: fork && stepping (Was: [RFC,PATCH 0/14] utrace/ptrace)
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.
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <assert.h>
#include <sys/syscall.h>
int main(void)
{
void *addr_after_fork = &&after_fork;
int pid, status;
if (!(pid = fork())) {
assert(ptrace(PTRACE_TRACEME) == 0);
kill(getpid(), SIGSTOP);
if (!syscall(__NR_fork)) {
/* kernel bug: this child will be killed by SIGTRAP */
printf("Hello world\n");
return 43;
}
after_fork: wait(&status);
return WEXITSTATUS(status);
}
for (;;) {
siginfo_t info;
assert(pid == wait(&status));
assert(ptrace(PTRACE_GETSIGINFO, pid, 0,&info) == 0);
if (info.si_addr == addr_after_fork)
break;
assert(ptrace(PTRACE_SINGLESTEP, pid, 0,0) == 0);
}
for (;;) {
if (WIFEXITED(status))
break;
assert(ptrace(PTRACE_CONT, pid, 0,0) == 0);
assert(pid == wait(&status));
}
assert(WEXITSTATUS(status) == 43);
return 0;
}
--
Veaceslav
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists