Skip to content

Commit

Permalink
shift "ptrace implies WUNTRACED" from ptrace_do_wait() to wait_task_s…
Browse files Browse the repository at this point in the history
…topped()

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>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jun 18, 2009
1 parent 3b34fc5 commit 4791802
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4791802

Please sign in to comment.