Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2446939imm; Mon, 16 Jul 2018 08:09:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdH21Kr4Yd4Gxw26tZso7G1Mdc4xV/yB7rH4+pwf+QAwxEcRItv98nGaWKRyduQMhx8RC82 X-Received: by 2002:a17:902:280b:: with SMTP id e11-v6mr16982401plb.298.1531753766902; Mon, 16 Jul 2018 08:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531753766; cv=none; d=google.com; s=arc-20160816; b=uAOpEcNXqnSBSd3od+3q0jqNFWVWeqgntcdYiUjCmjwd+2Sc6S+tJ9qTeW3MW3WtOa 0Xm8rXR0pn4Zii5xWNAdluA0FoN+/F/olescDVkJwQWoux83Rlfta8Xjo/F1AOXVRAEF 18gHE0KmsDLOfYFC0nMSs6ftscNTXIN4+YSTfWrL2DR4UtWIGwkKak7yprBPI1HVuRug VVnLzXHm/Z14q9rYX8h94U4rsAY6TW+vevFuH5ux4K7UmK679UKYr1noCxltllYPhBO1 pM4wIXKZu5fHlbO7KXvJr/6KRvxet8kXAdNFPma2z2EY9lyyAJH7lkcpD6U2rMayZ46R IWQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=hTAMjQFZ/IxF8oquYOOvg6JPgtNhHJf1qz2gHqqtlSM=; b=eYeyCDducTHBLjeyJXTj/yMJVjsL0SvYRYvJ8nsoh2O2j1AlnUywRrukRW0C+t1JeW S0do1jH2UwO4f1j2aBRRBCD6QcIYD7DkccpCCy8ygAbfSVXfSwiQRU+OXg82K8q0nViJ eY+GutT9/osk/Eq/8JqBo3R8NysPXkF3HTs2PsXUdJYc7Fc4B1/qG7r42K6EPhtRrzLb 9O/jcP2MZMd7k6iaJoU+Oyi6CQwLcAtmnCH2yeNti9avBkZ1N4WM9bZoLRSMCrgjWYca i/3yQy69rA3ZlyusmaN0jP7Ij9qjUmsSlLpVpDkFnL3rGOsxP8fBjpU2n8/Qw8Jbm0D1 kXiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y34-v6si30431928plb.17.2018.07.16.08.09.12; Mon, 16 Jul 2018 08:09:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728945AbeGPPgS (ORCPT + 99 others); Mon, 16 Jul 2018 11:36:18 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:33615 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbeGPPgS (ORCPT ); Mon, 16 Jul 2018 11:36:18 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ff56x-0005Ul-EU; Mon, 16 Jul 2018 09:08:27 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ff56w-0001X9-Pg; Mon, 16 Jul 2018 09:08:27 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, Wen Yang , majiang References: <877em2jxyr.fsf_-_@xmission.com> <20180711024459.10654-9-ebiederm@xmission.com> <20180716145540.GA20960@redhat.com> Date: Mon, 16 Jul 2018 10:08:22 -0500 In-Reply-To: <20180716145540.GA20960@redhat.com> (Oleg Nesterov's message of "Mon, 16 Jul 2018 16:55:40 +0200") Message-ID: <87lgabrzfd.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1ff56w-0001X9-Pg;;;mid=<87lgabrzfd.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/lOV6g8ozUF3mOjoGUbBHzizy+QK7i25g= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: **** X-Spam-Status: No, score=4.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, XMGappySubj_01,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.5 XMGappySubj_01 Very gappy subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4997] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ****;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 249 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 2.7 (1.1%), b_tie_ro: 1.75 (0.7%), parse: 1.26 (0.5%), extract_message_metadata: 18 (7.3%), get_uri_detail_list: 2.4 (1.0%), tests_pri_-1000: 9 (3.4%), tests_pri_-950: 1.28 (0.5%), tests_pri_-900: 1.04 (0.4%), tests_pri_-400: 39 (15.9%), check_bayes: 38 (15.4%), b_tokenize: 12 (4.9%), b_tok_get_all: 6 (2.4%), b_comp_prob: 2.9 (1.2%), b_tok_touch_all: 2.9 (1.2%), b_finish: 3.9 (1.6%), tests_pri_0: 168 (67.4%), check_dkim_signature: 0.62 (0.2%), check_dkim_adsp: 3.8 (1.5%), tests_pri_500: 4.6 (1.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC][PATCH 09/11] tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasks 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 in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > On 07/10, Eric W. Biederman wrote: >> >> Therefore use do_send_sig_info in all cases in __do_SAK to kill >> tasks as allows for exactly what the code wants to do. > > OK, but probably the changelog should also mention that now even the global > init will be killed if it has this tty opened. force_sig was ensuring the global init would die. So that isn't a change. Mentioning it isn't a bad idea. The change for global init is it will now die if init is a member of the session or init is using this tty as it's controlling tty. Semantically killing init with SAK is completely appropriate. As otherwise the guarantee that nothing has the terminal open will be present. So yes I will update the description. Eric >> Signed-off-by: "Eric W. Biederman" >> --- >> drivers/tty/tty_io.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c >> index cec58c53b0c4..42ac168c2a47 100644 >> --- a/drivers/tty/tty_io.c >> +++ b/drivers/tty/tty_io.c >> @@ -2747,7 +2747,7 @@ void __do_SAK(struct tty_struct *tty) >> do_each_pid_task(session, PIDTYPE_SID, p) { >> tty_notice(tty, "SAK: killed process %d (%s): by session\n", >> task_pid_nr(p), p->comm); >> - send_sig(SIGKILL, p, 1); >> + do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); >> } while_each_pid_task(session, PIDTYPE_SID, p); >> >> /* Now kill any processes that happen to have the tty open */ >> @@ -2755,7 +2755,7 @@ void __do_SAK(struct tty_struct *tty) >> if (p->signal->tty == tty) { >> tty_notice(tty, "SAK: killed process %d (%s): by controlling tty\n", >> task_pid_nr(p), p->comm); >> - send_sig(SIGKILL, p, 1); >> + do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); >> continue; >> } >> task_lock(p); >> @@ -2763,7 +2763,7 @@ void __do_SAK(struct tty_struct *tty) >> if (i != 0) { >> tty_notice(tty, "SAK: killed process %d (%s): by fd#%d\n", >> task_pid_nr(p), p->comm, i - 1); >> - force_sig(SIGKILL, p); >> + do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); >> } >> task_unlock(p); >> } while_each_thread(g, p); >> -- >> 2.17.1 >>