From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Andi Kleen <andi@firstfloor.org>,
Ananth Mavinakayanahalli <ananth@in.ibm.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: [PATCH 2/7] tracehooks: check PT_PTRACED before reporting the single-step
Date: Fri, 18 Dec 2009 02:11:24 +0100 [thread overview]
Message-ID: <20091218011124.GA29545@redhat.com> (raw)
No functional changes, preparation for utrace-ptrace.
tracehook_report_syscall_exit() and tracehook_signal_handler() assume
that only ptrace can set TIF_SINGLESTEP. Currently this is true but we
are going to change this, the stepping logic will be moved into utrace
layer.
Change this code to check PT_PTRACED, ptrace-utrace doesn't set it.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
include/linux/tracehook.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- V1/include/linux/tracehook.h~2_SIGNAL_HANDLER_CK_PTRACE 2009-12-18 00:38:09.000000000 +0100
+++ V1/include/linux/tracehook.h 2009-12-18 00:45:42.000000000 +0100
@@ -134,7 +134,7 @@ static inline __must_check int tracehook
*/
static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
{
- if (step) {
+ if (step && (task_ptrace(current) & PT_PTRACED)) {
siginfo_t info;
user_single_step_siginfo(current, regs, &info);
force_sig_info(SIGTRAP, &info, current);
@@ -386,7 +386,7 @@ static inline void tracehook_signal_hand
const struct k_sigaction *ka,
struct pt_regs *regs, int stepping)
{
- if (stepping)
+ if (stepping && (task_ptrace(current) & PT_PTRACED))
ptrace_notify(SIGTRAP);
}
reply other threads:[~2009-12-18 1:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20091218011124.GA29545@redhat.com \
--to=oleg@redhat.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=andi@firstfloor.org \
--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