From: Oleg Nesterov <oleg@redhat.com>
To: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
"Frank Ch. Eigler" <fche@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org, utrace-devel@redhat.com
Subject: Re: [RFC,PATCH 0/14] utrace/ptrace
Date: Wed, 25 Nov 2009 16:40:52 +0100 [thread overview]
Message-ID: <20091125154052.GA6734@redhat.com> (raw)
In-Reply-To: <20091125080342.GD2660@in.ibm.com>
On 11/25, Ananth N Mavinakayanahalli wrote:
>
> I ran the ptrace-tests testsuite [1] on powerpc on the vanilla ptrace
> and then with ptrace/utrace. The results for ptrace/utrace look better
> :-)
Great! thanks a lot Ananth for doing this.
ptrace-utrace still fails 2 tests,
> FAIL: syscall-reset
I'll take a look later. Since unpatched kernel fails this test too
I am not going to worry right now. I think this is ppc specific, x86
passes this test.
> step-fork: step-fork.c:56: handler_fail: Assertion `0' failed.
> /bin/sh: line 5: 24803 Aborted ${dir}$tst
> FAIL: step-fork
This is expected. Should be fixed by
ptrace-copy_process-should-disable-stepping.patch
in -mm tree. (I am attaching this patch below just in case)
I din't mention this patch in this series because this bug
is "ortogonal" to utrace/ptrace.
Oleg.
------------------------------------------------------
If the tracee calls fork() after PTRACE_SINGLESTEP, the forked child
starts with TIF_SINGLESTEP/X86_EFLAGS_TF bits copied from ptraced parent.
This is not right, especially when the new child is not auto-attaced: in
this case it is killed by SIGTRAP.
Change copy_process() to call user_disable_single_step(). Tested on x86.
Test-case:
#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()) {
/* kernel bug: this child will be killed by SIGTRAP */
printf("Hello world\n");
return 43;
}
wait(&status);
return WEXITSTATUS(status);
}
for (;;) {
assert(pid == wait(&status));
if (WIFEXITED(status))
break;
assert(ptrace(PTRACE_SINGLESTEP, pid, 0,0) == 0);
}
assert(WEXITSTATUS(status) == 43);
return 0;
}
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
diff -puN kernel/fork.c~ptrace-copy_process-should-disable-stepping kernel/fork.c
--- a/kernel/fork.c~ptrace-copy_process-should-disable-stepping
+++ a/kernel/fork.c
@@ -1203,9 +1203,10 @@ static struct task_struct *copy_process(
p->sas_ss_sp = p->sas_ss_size = 0;
/*
- * Syscall tracing should be turned off in the child regardless
- * of CLONE_PTRACE.
+ * Syscall tracing and stepping should be turned off in the
+ * child regardless of CLONE_PTRACE.
*/
+ user_disable_single_step(p);
clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
#ifdef TIF_SYSCALL_EMU
clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
next prev parent reply other threads:[~2009-11-25 15:46 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-24 20:01 [RFC,PATCH 0/14] utrace/ptrace Oleg Nesterov
2009-11-25 8:03 ` Ananth N Mavinakayanahalli
2009-11-25 15:40 ` Oleg Nesterov [this message]
2009-11-26 7:53 ` Ananth N Mavinakayanahalli
2009-11-26 14:50 ` powerpc: fork && stepping (Was: [RFC,PATCH 0/14] utrace/ptrace) Oleg Nesterov
2009-11-26 17:25 ` Oleg Nesterov
2009-11-26 18:22 ` Veaceslav Falico
2009-11-26 20:23 ` Oleg Nesterov
2009-11-26 21:04 ` Oleg Nesterov
2009-11-26 21:53 ` Paul Mackerras
2009-11-26 22:37 ` Oleg Nesterov
2009-11-27 17:46 ` Veaceslav Falico
2009-11-28 7:30 ` Ananth N Mavinakayanahalli
2009-11-29 21:07 ` powerpc: syscall_dotrace() && retcode (Was: powerpc: fork && stepping) Oleg Nesterov
2009-11-29 23:15 ` Benjamin Herrenschmidt
2009-11-30 0:43 ` Benjamin Herrenschmidt
2009-11-30 20:00 ` Oleg Nesterov
2009-11-30 20:01 ` Oleg Nesterov
2009-12-01 19:27 ` Roland McGrath
2009-12-01 20:17 ` Benjamin Herrenschmidt
2009-11-26 22:40 ` powerpc: fork && stepping (Was: [RFC,PATCH 0/14] utrace/ptrace) Andreas Schwab
2009-11-27 5:39 ` Ananth N Mavinakayanahalli
2009-11-27 15:05 ` Oleg Nesterov
2009-11-28 7:06 ` Ananth N Mavinakayanahalli
2009-11-25 21:48 ` [RFC,PATCH 0/14] utrace/ptrace Christoph Hellwig
2009-11-25 22:28 ` Oleg Nesterov
2009-11-26 7:07 ` Srikar Dronamraju
2009-11-26 12:55 ` Peter Zijlstra
2009-11-26 9:10 ` Ingo Molnar
2009-11-26 10:47 ` Christoph Hellwig
2009-11-26 12:24 ` Ingo Molnar
2009-11-27 14:04 ` Christoph Hellwig
2009-11-27 14:17 ` Oleg Nesterov
2009-11-27 19:16 ` Ingo Molnar
2009-11-26 14:27 ` Oleg Nesterov
2009-12-02 0:46 ` Roland McGrath
2009-11-29 8:59 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091125154052.GA6734@redhat.com \
--to=oleg@redhat.com \
--cc=adobriyan@gmail.com \
--cc=ananth@in.ibm.com \
--cc=fche@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=roland@redhat.com \
--cc=utrace-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox