Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2431619imm; Mon, 16 Jul 2018 07:57:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7963dmDwU0RU9kExIPP1atR9hRHwch/x7iJgi9IZV7qe2IKaKaklNMDod4N2Bea6Dq+BF X-Received: by 2002:a62:2f84:: with SMTP id v126-v6mr4540689pfv.115.1531753032645; Mon, 16 Jul 2018 07:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531753032; cv=none; d=google.com; s=arc-20160816; b=rSQtPidGOeVIPZN7IuIKCI468D0q9QVyuIiDwHbYQ3NgZRvmouo9bFxJoekmaWaGwb To15lMWjNGyZHTDm2e8R9cUlOpXAcKiD+YKgVEORAI4zmShDLwZapGftF1ufITqOMjhE tempX9D3fgUdKaT6ohK6BB598r0zaRPy8e3g9ZQNiFBHD3f/BaESxJ+va4y/umACcEuu kNzSKdGUx4u9O9QC27MwBQyfnYJewg/Q3ia39N0gNVzZo6BAqCCQn3KBkJ4fIkQRlCTQ YfwAv4j6UBE/2Io2sPmPcxZn0Mp5lS/To3/Wk7dxPhNv/6Ke85Gc6Xb2iK1MXlicRdkH elow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=4MiKL9rpdERdiI3p1uXDaa1EBGSpMuTO8Br9ZA9qOc4=; b=iNKNCIqoLR1MaCjBJW0ChvuDKU8Y4/8vA/G8ao9eFGTq+L0PNDCc+aZEPdKsv+AWVF dFDomHqWFFdgJjCNJfbr6XPS/c2/6wQ4ORDSygpTZ1MbZ08BEAtlwRBEznVJDthrV+GP DksbUfxObj2dg9UTxSuc5Qw4glLdkTv+3ENUTBSsHu0J1B3DVAG/uvVj8nGkr5onxIhV FxFerlB260/nwnYCSK2+zy1UF4KAqYLJAJPKdlS7gIRstpaV7rFOSMax9TAPS4v3AEIf oD5Pe+L67pFduRdLLHOcAxLUOz6rxx0bcuIkVN3SgFAck7rrlG7DOYurL3lvPDa93Rci QNUA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17-v6si30704490pfj.104.2018.07.16.07.56.56; Mon, 16 Jul 2018 07:57:12 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729834AbeGPPXb (ORCPT + 99 others); Mon, 16 Jul 2018 11:23:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60434 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729357AbeGPPXb (ORCPT ); Mon, 16 Jul 2018 11:23:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD2424022414; Mon, 16 Jul 2018 14:55:43 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id 641D2111CB8E; Mon, 16 Jul 2018 14:55:41 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 16 Jul 2018 16:55:43 +0200 (CEST) Date: Mon, 16 Jul 2018 16:55:40 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, Wen Yang , majiang Subject: Re: [RFC][PATCH 09/11] tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasks Message-ID: <20180716145540.GA20960@redhat.com> References: <877em2jxyr.fsf_-_@xmission.com> <20180711024459.10654-9-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711024459.10654-9-ebiederm@xmission.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 16 Jul 2018 14:55:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 16 Jul 2018 14:55:43 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'oleg@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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 >