aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/signal.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 4c4ad34caf77..0a1bf2c8bdcd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1760,15 +1760,6 @@ static int sigkill_pending(struct task_struct *tsk)
1760} 1760}
1761 1761
1762/* 1762/*
1763 * Test whether the target task of the usual cldstop notification - the
1764 * real_parent of @child - is in the same group as the ptracer.
1765 */
1766static bool real_parent_is_ptracer(struct task_struct *child)
1767{
1768 return same_thread_group(child->parent, child->real_parent);
1769}
1770
1771/*
1772 * This must be called with current->sighand->siglock held. 1763 * This must be called with current->sighand->siglock held.
1773 * 1764 *
1774 * This should be the path for all ptrace stops. 1765 * This should be the path for all ptrace stops.
@@ -1848,7 +1839,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
1848 * separately unless they're gonna be duplicates. 1839 * separately unless they're gonna be duplicates.
1849 */ 1840 */
1850 do_notify_parent_cldstop(current, true, why); 1841 do_notify_parent_cldstop(current, true, why);
1851 if (gstop_done && !real_parent_is_ptracer(current)) 1842 if (gstop_done && ptrace_reparented(current))
1852 do_notify_parent_cldstop(current, false, why); 1843 do_notify_parent_cldstop(current, false, why);
1853 1844
1854 /* 1845 /*
@@ -2154,7 +2145,6 @@ relock:
2154 * the CLD_ si_code into SIGNAL_CLD_MASK bits. 2145 * the CLD_ si_code into SIGNAL_CLD_MASK bits.
2155 */ 2146 */
2156 if (unlikely(signal->flags & SIGNAL_CLD_MASK)) { 2147 if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
2157 struct task_struct *leader;
2158 int why; 2148 int why;
2159 2149
2160 if (signal->flags & SIGNAL_CLD_CONTINUED) 2150 if (signal->flags & SIGNAL_CLD_CONTINUED)
@@ -2175,13 +2165,11 @@ relock:
2175 * a duplicate. 2165 * a duplicate.
2176 */ 2166 */
2177 read_lock(&tasklist_lock); 2167 read_lock(&tasklist_lock);
2178
2179 do_notify_parent_cldstop(current, false, why); 2168 do_notify_parent_cldstop(current, false, why);
2180 2169
2181 leader = current->group_leader; 2170 if (ptrace_reparented(current->group_leader))
2182 if (leader->ptrace && !real_parent_is_ptracer(leader)) 2171 do_notify_parent_cldstop(current->group_leader,
2183 do_notify_parent_cldstop(leader, true, why); 2172 true, why);
2184
2185 read_unlock(&tasklist_lock); 2173 read_unlock(&tasklist_lock);
2186 2174
2187 goto relock; 2175 goto relock;