Skip to content

Commit 629d362

Browse files
oleg-nesterovtorvalds
authored andcommitted
signal: give SEND_SIG_FORCED more power to beat SIGNAL_UNKILLABLE
force_sig_info() and friends have the special semantics for synchronous signals, this interface should not be used if the target is not current. And it needs the fixes, in particular the clearing of SIGNAL_UNKILLABLE is not exactly right. However there are callers which have to use force_ exactly because it clears SIGNAL_UNKILLABLE and thus it can kill the CLONE_NEWPID tasks, although this is almost always is wrong by various reasons. With this patch SEND_SIG_FORCED ignores SIGNAL_UNKILLABLE, like we do if the signal comes from the ancestor namespace. This makes the naming in prepare_signal() paths insane, fixed by the next cleanup. Note: this only affects SIGKILL/SIGSTOP, but this is enough for force_sig() abusers. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 43aca32 commit 629d362

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/signal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,8 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
10591059
assert_spin_locked(&t->sighand->siglock);
10601060

10611061
result = TRACE_SIGNAL_IGNORED;
1062-
if (!prepare_signal(sig, t, from_ancestor_ns))
1062+
if (!prepare_signal(sig, t,
1063+
from_ancestor_ns || (info == SEND_SIG_FORCED)))
10631064
goto ret;
10641065

10651066
pending = group ? &t->signal->shared_pending : &t->pending;

0 commit comments

Comments
 (0)