Commit bb3696da authored by Oleg Nesterov's avatar Oleg Nesterov

ptrace: kill real_parent_is_ptracer() in in favor of ptrace_reparented()

Kill real_parent_is_ptracer() and update the callers to use
ptrace_reparented(), after the previous patch they do the same.

Remove the unnecessary ->ptrace != 0 check in get_signal_to_deliver(),
if ptrace_reparented() == T then the task must be ptraced.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
parent 0347e177
...@@ -1759,15 +1759,6 @@ static int sigkill_pending(struct task_struct *tsk) ...@@ -1759,15 +1759,6 @@ static int sigkill_pending(struct task_struct *tsk)
sigismember(&tsk->signal->shared_pending.signal, SIGKILL); sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
} }
/*
* Test whether the target task of the usual cldstop notification - the
* real_parent of @child - is in the same group as the ptracer.
*/
static bool real_parent_is_ptracer(struct task_struct *child)
{
return same_thread_group(child->parent, child->real_parent);
}
/* /*
* This must be called with current->sighand->siglock held. * This must be called with current->sighand->siglock held.
* *
...@@ -1848,7 +1839,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) ...@@ -1848,7 +1839,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
* separately unless they're gonna be duplicates. * separately unless they're gonna be duplicates.
*/ */
do_notify_parent_cldstop(current, true, why); do_notify_parent_cldstop(current, true, why);
if (gstop_done && !real_parent_is_ptracer(current)) if (gstop_done && ptrace_reparented(current))
do_notify_parent_cldstop(current, false, why); do_notify_parent_cldstop(current, false, why);
/* /*
...@@ -2154,7 +2145,6 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, ...@@ -2154,7 +2145,6 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
* the CLD_ si_code into SIGNAL_CLD_MASK bits. * the CLD_ si_code into SIGNAL_CLD_MASK bits.
*/ */
if (unlikely(signal->flags & SIGNAL_CLD_MASK)) { if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
struct task_struct *leader;
int why; int why;
if (signal->flags & SIGNAL_CLD_CONTINUED) if (signal->flags & SIGNAL_CLD_CONTINUED)
...@@ -2175,13 +2165,11 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, ...@@ -2175,13 +2165,11 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
* a duplicate. * a duplicate.
*/ */
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_notify_parent_cldstop(current, false, why); do_notify_parent_cldstop(current, false, why);
leader = current->group_leader; if (ptrace_reparented(current->group_leader))
if (leader->ptrace && !real_parent_is_ptracer(leader)) do_notify_parent_cldstop(current->group_leader,
do_notify_parent_cldstop(leader, true, why); true, why);
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
goto relock; goto relock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment