[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1290768569-16224-5-git-send-email-tj@kernel.org>
Date: Fri, 26 Nov 2010 11:49:19 +0100
From: Tejun Heo <tj@...nel.org>
To: roland@...hat.com, oleg@...hat.com, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
"rjw@...k.plpavel"@ucw.cz
Cc: Tejun Heo <tj@...nel.org>
Subject: [PATCH 04/14] signal: don't notify parent if not stopping after tracehook_notify_jctl() in do_signal_stop()
do_signal_stop() tests sig->group_stop_count one more time after
calling tracehook_notify_jctl() as it's allowed release siglock. If
group_stop_count has changed to zero, it no longer stops but still
notifies the parent. For both SIGCONT and KILL which could cause the
condition, this notification is unnecessary.
SIGCONT will be notified to the parent when the task calls
get_signal_to_deliver() right after returning from do_signal_stop()
which will handle the collapsed notification correctly by itself. The
notification from do_signal_stop() in this case would only cause
duplication. For SIGKILL, the imminent death of the task will be
notified to parent and it's completely superflous to report the
skipped stop.
Also, tracehook_notify_jctl() doesn't release siglock, so, currently,
none of these matters at all.
This patch updates do_signal_stop() such that it jumps out of the
function if group_stop_count has dropped during
tracehook_notify_jctl().
This doesn't cause any behavior difference as the condition never
triggers in the current code.
Signed-off-by: Tejun Heo <tj@...nel.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Roland McGrath <roland@...hat.com>
---
kernel/signal.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index 0a6816a..6f7407d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1763,15 +1763,20 @@ static int do_signal_stop(int signr)
notify = tracehook_notify_jctl(notify, CLD_STOPPED);
/*
* tracehook_notify_jctl() can drop and reacquire siglock, so
- * we keep ->group_stop_count != 0 before the call. If SIGCONT
- * or SIGKILL comes in between ->group_stop_count == 0.
+ * we test ->group_stop_count again. If SIGCONT or SIGKILL
+ * comes in between, ->group_stop_count == 0.
*/
- if (sig->group_stop_count) {
- if (!--sig->group_stop_count)
- sig->flags = SIGNAL_STOP_STOPPED;
- current->exit_code = sig->group_exit_code;
- __set_current_state(TASK_STOPPED);
+ if (!sig->group_stop_count) {
+ spin_unlock_irq(¤t->sighand->siglock);
+ goto out;
}
+
+ if (!--sig->group_stop_count)
+ sig->flags = SIGNAL_STOP_STOPPED;
+
+ current->exit_code = sig->group_exit_code;
+ __set_current_state(TASK_STOPPED);
+
spin_unlock_irq(¤t->sighand->siglock);
if (notify) {
@@ -1782,7 +1787,7 @@ static int do_signal_stop(int signr)
/* Now we don't run again until woken by SIGCONT or SIGKILL */
schedule();
-
+out:
tracehook_finish_jctl();
current->exit_code = 0;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists