From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Roland McGrath <roland@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Matthew Wilcox <matthew@wil.cx>,
linux-kernel@vger.kernel.org
Subject: [PATCH -mm 2/2] kill my_ptrace_child()
Date: Tue, 20 Nov 2007 18:21:36 +0300 [thread overview]
Message-ID: <20071120152136.GA4549@tv-sign.ru> (raw)
Now that my_ptrace_child() is trivial we can use the "p->ptrace & PT_PTRACED"
inline and simplify the corresponding logic in do_wait: we can't find the child
in TASK_TRACED state without PT_PTRACED flag set, ptrace_untrace() either sets
TASK_STOPPED or wakes up the tracee.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- PT/kernel/exit.c~2_my_ptrace_child 2007-11-20 17:21:52.000000000 +0300
+++ PT/kernel/exit.c 2007-11-20 17:54:07.000000000 +0300
@@ -1510,12 +1510,6 @@ static int wait_task_continued(struct ta
return retval;
}
-
-static inline int my_ptrace_child(struct task_struct *p)
-{
- return p->ptrace & PT_PTRACED;
-}
-
static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
int __user *stat_addr, struct rusage __user *ru)
{
@@ -1554,22 +1548,11 @@ repeat:
/*
* It's stopped now, so it might later
* continue, exit, or stop again.
- *
- * When we hit the race with PTRACE_ATTACH, we
- * will not report this child. But the race
- * means it has not yet been moved to our
- * ptrace_children list, so we need to set the
- * flag here to avoid a spurious ECHILD when
- * the race happens with the only child.
*/
flag = 1;
-
- if (!my_ptrace_child(p)) {
- if (is_task_traced(p))
- continue;
- if (!(options & WUNTRACED))
- continue;
- }
+ if (!(p->ptrace & PT_PTRACED) &&
+ !(options & WUNTRACED))
+ continue;
retval = wait_task_stopped(p, ret == 2,
(options & WNOWAIT), infop,
next reply other threads:[~2007-11-20 15:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 15:21 Oleg Nesterov [this message]
2007-11-20 21:10 ` [PATCH -mm 2/2] kill my_ptrace_child() Roland McGrath
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=20071120152136.GA4549@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=roland@redhat.com \
--cc=torvalds@linux-foundation.org \
/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