• Oleg Nesterov's avatar
    signals: fix /sbin/init protection from unwanted signals · fae5fa44
    Oleg Nesterov authored
    The global init has a lot of long standing problems with the unhandled fatal
    signals.
    
    	- The "is_global_init(current)" check in get_signal_to_deliver()
    	  protects only the main thread. Sub-thread can dequee the fatal
    	  signal and shutdown the whole thread group except the main thread.
    	  If it dequeues SIGSTOP /sbin/init will be stopped, this is not
    	  right too. Note that we can't use is_global_init(->group_leader),
    	  this breaks exec and this can't solve other problems we have.
    
    	- Even if afterwards ignored, the fatal signals sets SIGNAL_GROUP_EXIT
    	  on delivery. This breaks exec, has other bad implications, and this
    	  is just wrong.
    
    Introduce the new SIGNAL_UNKILLABLE flag to fix these problems.  It also helps
    to solve some other problems addressed by the subsequent patches.
    
    Currently we use this flag for the global init only, but it could also be used
    by kthreads and (perhaps) by the sub-namespace inits.
    Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
    Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Roland McGrath <roland@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    fae5fa44
signal.c 63.3 KB