public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@redhat.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>,
	 gregkh@linuxfoundation.org,  jslaby@suse.com,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] Revert "do_SAK: Don't recursively take the tasklist_lock"
Date: Wed, 17 Jan 2018 11:49:31 -0600	[thread overview]
Message-ID: <87tvvke5p0.fsf@xmission.com> (raw)
In-Reply-To: <20180117173415.GA7964@redhat.com> (Oleg Nesterov's message of "Wed, 17 Jan 2018 18:34:15 +0100")

Oleg Nesterov <oleg@redhat.com> writes:

> On 01/17, Eric W. Biederman wrote:
>
>> Kirill Tkhai <ktkhai@virtuozzo.com> writes:
>>
>> > This reverts commit 20ac94378de5.
>> >
>> > send_sig() does not take tasklist_lock for a long time,
>> > so this commit and the problem it solves are not relevant
>> > anymore.
>> >
>> > Also, the problem of force_sig() is it clears SIGNAL_UNKILLABLE
>> > flag, thus even global init may be killed by __do_SAK(),
>> > which is definitely not the expected behavior.
>>
>> Actually it is.
>>
>> SAK should kill everything that has the tty open.  If init opens the tty
>> I am so sorry, it can not operate correctly.  init should not have your
>> tty open.
>
> OK, but then we need "force" in other places too. __do_SAK() does send_sig(SIGKILL)
> in do_each_pid_task(PIDTYPE_SID) and if signal->tty == tty.
>
> Plus force_sig() is not rcu-friendly.
>
> So I personally agree with this change. Whether we want to kill the global init
> or not should be discussed, if we want to do this __do_SAK() should use
> SEND_SIG_FORCED and this is what Kirill is going to do (iiuc), but this needs
> another patch.

To operate correctly, do_SAK() needs to kill everything that has the tty
open.  Unless we can make that guarantee I don't see the point of
changing do_SAK.

It would be better to give up on do_SAK altogether than to keep do_SAK
limping along and failing to meet it's security guarantees.

If there are real world races, let's document those and say do_SAK has
been broken for X number of years and just remove it.  Right now that
seems the more reasonable course.

Unless there truly is someone using do_SAK to ensure they have a tty all
to themselves.

Eric

  reply	other threads:[~2018-01-17 17:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 12:39 [PATCH v2 0/3] tty: Make __do_SAK() less greedy in regard to tasklist_lock Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 1/3] Revert "do_SAK: Don't recursively take the tasklist_lock" Kirill Tkhai
2018-01-17 17:18   ` Eric W. Biederman
2018-01-17 17:34     ` Oleg Nesterov
2018-01-17 17:49       ` Eric W. Biederman [this message]
2018-01-17 18:04         ` Oleg Nesterov
2018-01-17 18:37           ` Eric W. Biederman
2018-01-17 20:43             ` Oleg Nesterov
2018-01-18 10:07         ` Kirill Tkhai
2018-01-18  9:59     ` Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 2/3] tty: Avoid threads files iterations in __do_SAK() Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 3/3] tty: Use RCU read lock to iterate tasks and threads " Kirill Tkhai
2018-01-17 16:54   ` Eric W. Biederman
2018-01-17 17:39     ` Oleg Nesterov
2018-01-18 10:11     ` Kirill Tkhai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvvke5p0.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox