[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lgabrzfd.fsf@xmission.com>
Date: Mon, 16 Jul 2018 10:08:22 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Wen Yang <wen.yang99@....com.cn>,
majiang <ma.jiang@....com.cn>
Subject: Re: [RFC][PATCH 09/11] tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasks
Oleg Nesterov <oleg@...hat.com> 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" <ebiederm@...ssion.com>
>> ---
>> 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
>>
Powered by blists - more mailing lists