Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp12440imm; Tue, 10 Jul 2018 19:47:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfDMQGtJJYvbdpYnRZVom8MwELaCaWdHLhH40l56+65jXupX3Fp5EPNecJY48Xcgz4LRTW+ X-Received: by 2002:a62:e00a:: with SMTP id f10-v6mr28337431pfh.208.1531277264960; Tue, 10 Jul 2018 19:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531277264; cv=none; d=google.com; s=arc-20160816; b=cnHuD08O16ILeAw2Vqpfdi3ScHRVKmYUFmP0F6zMQ/nrYnuJL63NKVZIEbYuO5BYee KZB1hHj2p0+uwElsDYKlrPEh/ZwWCwna+qIAtobIkClzotl+Q32tTb9YNUsX3UAoxDEi hIExLUZB93pEP5DI7T3baU/EIBSpNxsKmNmCrozfPO2YYYEhIndquxd1eTiA/6zzVYRa KmoHuAjI7S52ubm1j6V3H+pEDYHv+6TPpuVGuSFHKq/w4tI5PiT6z7blTnioni4DgoDP DUzA9P4ybn8h/sRHanM2klnChu6yjrz09sR1p98blChY4vVYTFirqckT+ovwRXRQdlIm 76Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=Lx/I/HMjxMJCcw/ATlAY+Pby30Oc8TCWvEFueOGVbLo=; b=jYtxkdWzJqsKSMIMM7Ozeb7+FcyQ+L1rbrZFQsvyMdbmcLTTQbldufBOjhqVqxm9O0 vnsnWOV0WYJaFKbUupsR2QYVa5G5jsmmdxWfg00nwPEQIjM2KFT5t+fOzPX1rWoygT4Q jXlJ4b7f/ko2xj2J26xzWtzYVE1G2ZWaeqOKWbA8DhIHV2PYSxo5ix/Zivaicu+Pk1gV FeEZMs3D7P6KixAbBdXxWIJYIzxMC/VMoP5cmIP5BWQIPO7b0EO8CkzgiYfY1IQR/iie LxouAHJULQ96GKF87qxIxQoBG/15plwKT/dSLN5so8rOp1wG2PMMRGqi4WF64V1oxV14 sh5A== 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 d20-v6si16922876pgb.682.2018.07.10.19.47.30; Tue, 10 Jul 2018 19:47:44 -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 S1732425AbeGKCsj (ORCPT + 99 others); Tue, 10 Jul 2018 22:48:39 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:41559 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732385AbeGKCsi (ORCPT ); Tue, 10 Jul 2018 22:48:38 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fd59I-000778-Gi; Tue, 10 Jul 2018 20:46:36 -0600 Received: from [97.119.167.31] (helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fd59G-00063R-S7; Tue, 10 Jul 2018 20:46:36 -0600 From: "Eric W. Biederman" To: Linus Torvalds Cc: Oleg Nesterov , Andrew Morton , linux-kernel@vger.kernel.org, Wen Yang , majiang , "Eric W. Biederman" Date: Tue, 10 Jul 2018 21:44:57 -0500 Message-Id: <20180711024459.10654-9-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <877em2jxyr.fsf_-_@xmission.com> References: <877em2jxyr.fsf_-_@xmission.com> X-XM-SPF: eid=1fd59G-00063R-S7;;;mid=<20180711024459.10654-9-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/YveK+NqbqpTh8jRHkKRUEaEFg0fWvq2s= 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_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 * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.5 XMGappySubj_01 Very gappy subject * 0.7 XMSubLong Long Subject * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4988] * -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: ****;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 1189 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.4 (0.3%), b_tie_ro: 2.4 (0.2%), parse: 0.95 (0.1%), extract_message_metadata: 11 (0.9%), get_uri_detail_list: 1.57 (0.1%), tests_pri_-1000: 6 (0.5%), tests_pri_-950: 1.18 (0.1%), tests_pri_-900: 0.99 (0.1%), tests_pri_-400: 20 (1.6%), check_bayes: 18 (1.5%), b_tokenize: 7 (0.6%), b_tok_get_all: 5 (0.4%), b_comp_prob: 1.80 (0.2%), b_tok_touch_all: 2.3 (0.2%), b_finish: 0.68 (0.1%), tests_pri_0: 1138 (95.8%), check_dkim_signature: 0.44 (0.0%), check_dkim_adsp: 2.5 (0.2%), tests_pri_500: 4.7 (0.4%), rewrite_mail: 0.00 (0.0%) Subject: [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 send_sig is thread only making it the wrong command for an action directed at a process. force_sig does not set SEND_SIG_FORCED (causing unnecessary work in __send_signal) and jumps through unnecessary hoops to deal with blocked and ignored signals which SIGKILL can never be. 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. 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