Skip to content

Commit

Permalink
signal: Always ignore SIGKILL and SIGSTOP sent to the global init
Browse files Browse the repository at this point in the history
[ Upstream commit 86989c4 ]

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 <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ebiederm authored and gregkh committed Nov 20, 2019
1 parent ee01347 commit 0935780
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ static int 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 1;
Expand Down

0 comments on commit 0935780

Please sign in to comment.