From: Eric W. Biederman Date: Fri, 20 Jul 2018 00:47:27 +0000 (-0500) Subject: signal: Always ignore SIGKILL and SIGSTOP sent to the global init X-Git-Tag: v4.19.85~261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b5681d39fa45d198a8b83ca8c960263070f081e;p=platform%2Fkernel%2Flinux-rpi.git signal: Always ignore SIGKILL and SIGSTOP sent to the global init [ Upstream commit 86989c41b5ea08776c450cb759592532314a4ed6 ] If the first process started (aka /sbin/init) receives a SIGKILL it will panic the system if it is delivered. Making the system unusable and undebugable. It isn't much better if the first process started receives SIGSTOP. So always ignore SIGSTOP and SIGKILL sent to init. This is done in a separate clause in sig_task_ignored as force_sig_info can clear SIG_UNKILLABLE and this protection should work even then. Reviewed-by: Thomas Gleixner Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- diff --git a/kernel/signal.c b/kernel/signal.c index 0e6bc30..7278302 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -78,6 +78,10 @@ static bool sig_task_ignored(struct task_struct *t, int sig, bool force) handler = sig_handler(t, sig); + /* SIGKILL and SIGSTOP may not be sent to the global init */ + if (unlikely(is_global_init(t) && sig_kernel_only(sig))) + return true; + if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && handler == SIG_DFL && !(force && sig_kernel_only(sig))) return true;