diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-12-15 19:47:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:09 -0500 |
commit | dd34200adc01c5217ef09b55905b5c2312d65535 (patch) | |
tree | 7173ed6b5531086923a9221ef502f1dd2793c8a4 | |
parent | 614c517d7c00af1b26ded20646b329397d6f51a1 (diff) |
signals: send_signal: use si_fromuser() to detect from_ancestor_ns
Change send_signal() to use si_fromuser(). From now SEND_SIG_NOINFO
triggers the "from_ancestor_ns" check.
This fixes reparent_thread()->group_send_sig_info(pdeath_signal)
behaviour, before this patch send_signal() does not detect the
cross-namespace case when the child of the dying parent belongs to the
sub-namespace.
This patch can affect the behaviour of send_sig(), kill_pgrp() and
kill_pid() when the caller sends the signal to the sub-namespace with
"priv == 0" but surprisingly all callers seem to use them correctly,
including disassociate_ctty(on_exit).
Except: drivers/staging/comedi/drivers/addi-data/*.c incorrectly use
send_sig(priv => 0). But his is minor and should be fixed anyway.
Reported-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Reviewed-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/signal.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index a0ba428954b6..b65879d4e08f 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -960,9 +960,8 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t, | |||
960 | int from_ancestor_ns = 0; | 960 | int from_ancestor_ns = 0; |
961 | 961 | ||
962 | #ifdef CONFIG_PID_NS | 962 | #ifdef CONFIG_PID_NS |
963 | if (!is_si_special(info) && SI_FROMUSER(info) && | 963 | from_ancestor_ns = si_fromuser(info) && |
964 | task_pid_nr_ns(current, task_active_pid_ns(t)) <= 0) | 964 | !task_pid_nr_ns(current, task_active_pid_ns(t)); |
965 | from_ancestor_ns = 1; | ||
966 | #endif | 965 | #endif |
967 | 966 | ||
968 | return __send_signal(sig, info, t, group, from_ancestor_ns); | 967 | return __send_signal(sig, info, t, group, from_ancestor_ns); |