Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751838AbdFFTM1 (ORCPT ); Tue, 6 Jun 2017 15:12:27 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:49840 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751458AbdFFTMX (ORCPT ); Tue, 6 Jun 2017 15:12:23 -0400 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Ingo Molnar , Thomas Gleixner , Kees Cook , Roland McGrath , Al Viro , David Howells , "Michael Kerrisk (man-pages)" , "Eric W. Biederman" Date: Tue, 6 Jun 2017 14:03:21 -0500 Message-Id: <20170606190338.28347-9-ebiederm@xmission.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170606190338.28347-1-ebiederm@xmission.com> References: <877f0pym71.fsf@xmission.com> <20170606190338.28347-1-ebiederm@xmission.com> X-XM-SPF: eid=1dIJtp-0006wd-4I;;;mid=<20170606190338.28347-9-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.121.81.159;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+c3hE/m/ITn2sUuee0cpcJ1nLVbDEyy98= X-SA-Exim-Connect-IP: 97.121.81.159 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 5538 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.3 (0.0%), b_tie_ro: 1.59 (0.0%), parse: 0.75 (0.0%), extract_message_metadata: 9 (0.2%), get_uri_detail_list: 0.68 (0.0%), tests_pri_-1000: 6 (0.1%), tests_pri_-950: 1.10 (0.0%), tests_pri_-900: 0.92 (0.0%), tests_pri_-400: 25 (0.4%), check_bayes: 24 (0.4%), b_tokenize: 4.9 (0.1%), b_tok_get_all: 8 (0.1%), b_comp_prob: 1.76 (0.0%), b_tok_touch_all: 6 (0.1%), b_finish: 1.97 (0.0%), tests_pri_0: 147 (2.6%), check_dkim_signature: 0.48 (0.0%), check_dkim_adsp: 27 (0.5%), tests_pri_500: 5345 (96.5%), poll_dns_idle: 5337 (96.4%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 09/26] signal: Don't allow sending SIGKILL or SIGSTOP to init X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 791 Lines: 28 Even to init SIGKILL and SIGSTOP are alwasys delivered if they are sent, so don't allow tracing an init task allow them. Signed-off-by: "Eric W. Biederman" --- kernel/signal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/signal.c b/kernel/signal.c index 5eff2f9f8c42..627b482fa3f8 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -98,8 +98,12 @@ static int sig_ignored(struct task_struct *t, int sig, bool force) /* * Tracers may want to know about even ignored signals. + * We can never safely allow SIGKILL or SIGSTOP to + * be sent to init from it's children. */ - return !t->ptrace; + return !t->ptrace || + ((t->signal->flags & SIGNAL_UNKILLABLE) && + sig_kernel_only(sig) && !force); } /* -- 2.10.1