]> www.infradead.org Git - users/jedix/linux-maple.git/commit
signal: protect SIGNAL_UNKILLABLE from unintentional clearing.
authorJamie Iles <jamie.iles@oracle.com>
Wed, 11 Jan 2017 00:57:54 +0000 (16:57 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 5 Mar 2017 00:26:33 +0000 (16:26 -0800)
commitf23d3fe2fe5ee2e973c7046d79f9bab95b82dbeb
tree3820a35eaf1ceaf21fdc8724f0034a6865c70091
parent0f5f215d74bafe2271fa6dbbf2dc32dee57eb9b3
signal: protect SIGNAL_UNKILLABLE from unintentional clearing.

Since commit 00cd5c37afd5 ("ptrace: permit ptracing of /sbin/init") we
can now trace init processes.  init is initially protected with
SIGNAL_UNKILLABLE which will prevent fatal signals such as SIGSTOP, but
there are a number of paths during tracing where SIGNAL_UNKILLABLE can
be implicitly cleared.

This can result in init becoming stoppable/killable after tracing.  For
example, running:

  while true; do kill -STOP 1; done &
  strace -p 1

and then stopping strace and the kill loop will result in init being
left in state TASK_STOPPED.  Sending SIGCONT to init will resume it, but
init will now respond to future SIGSTOP signals rather than ignoring
them.

Make sure that when setting SIGNAL_STOP_CONTINUED/SIGNAL_STOP_STOPPED
that we don't clear SIGNAL_UNKILLABLE.

Orabug: 25414814

Link: http://lkml.kernel.org/r/20170104122017.25047-1-jamie.iles@oracle.com
Signed-off-by: Jamie Iles <jamie.iles@oracle.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
(cherry picked from commit 2d39b3cd34e6d323720d4c61bd714f5ae202c022)
include/linux/sched.h
kernel/signal.c