public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [FOR REVIEW, PATCH 1/2] shift "ptrace implies WUNTRACED" from ptrace_do_wait() to wait_task_stopped()
Date: Wed, 6 May 2009 07:33:22 +0200	[thread overview]
Message-ID: <20090506053322.GA31981@redhat.com> (raw)

No functional changes, preparation for the next patch.

ptrace_do_wait() adds WUNTRACED to options for wait_task_stopped()
which should always accept the stopped tracee, even if do_wait() was
called without WUNTRACED.

Change wait_task_stopped() to check "ptrace || WUNTRACED" instead.
This makes the code more explicit, and "int options" argument becomes
const in do_wait() pathes.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

 kernel/exit.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- PTRACE/kernel/exit.c~1_WUNTRACED	2009-05-03 23:24:14.000000000 +0200
+++ PTRACE/kernel/exit.c	2009-05-06 01:48:51.000000000 +0200
@@ -1330,7 +1330,8 @@ static int wait_task_stopped(int ptrace,
 	uid_t uid = 0; /* unneeded, required by compiler */
 	pid_t pid;
 
-	if (!(options & WUNTRACED))
+	/* Traditionally we see ptrace'd stopped tasks regardless of options */
+	if (!ptrace && !(options & WUNTRACED))
 		return 0;
 
 	exit_code = 0;
@@ -1548,11 +1549,6 @@ static int ptrace_do_wait(struct task_st
 {
 	struct task_struct *p;
 
-	/*
-	 * Traditionally we see ptrace'd stopped tasks regardless of options.
-	 */
-	options |= WUNTRACED;
-
 	list_for_each_entry(p, &tsk->ptraced, ptrace_entry) {
 		int ret = wait_consider_task(tsk, 1, p, notask_error,
 					     type, pid, options,


             reply	other threads:[~2009-05-06  5:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  5:33 Oleg Nesterov [this message]
2009-05-06 20:01 ` [FOR REVIEW, PATCH 1/2] shift "ptrace implies WUNTRACED" from ptrace_do_wait() to wait_task_stopped() 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=20090506053322.GA31981@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@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