shift "ptrace implies WUNTRACED" from ptrace_do_wait() to wait_task_stopped()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, June 18, 2009 - 3:00 pm

Gitweb:     http://git.kernel.org/linus/47918025efdabd34e96b13b26eb2cf2fd6fd1f7c
Commit:     47918025efdabd34e96b13b26eb2cf2fd6fd1f7c
Parent:     3b34fc5880a2dcc7e5ed9837ef8d6bae051ab266
Author:     Oleg Nesterov <oleg@redhat.com>
AuthorDate: Wed Jun 17 16:27:39 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Jun 18 13:03:52 2009 -0700

    shift "ptrace implies WUNTRACED" from ptrace_do_wait() to wait_task_stopped()
    
    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>
    Acked-by: Roland McGrath <roland@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 kernel/exit.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 94a9992..fd781b5 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1330,7 +1330,10 @@ static int wait_task_stopped(int ptrace, struct task_struct *p,
 	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 +1551,6 @@ static int ptrace_do_wait(struct task_struct *tsk, int *notask_error,
 {
 	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,
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
shift "ptrace implies WUNTRACED" from ptrace_do_wait() to ..., Linux Kernel Mailing ..., (Thu Jun 18, 3:00 pm)